]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
Work around imagemagick regression that puts everything upside down 86/head
authorbones_was_here <bones_was_here@xa.org.au>
Mon, 17 Jan 2022 17:25:22 +0000 (03:25 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Mon, 17 Jan 2022 17:25:22 +0000 (03:25 +1000)
Signed-off-by: bones_was_here <bones_was_here@xa.org.au>
misc/tools/autoshader.sh
misc/tools/brightspot.sh
misc/tools/cached-converter.sh
misc/tools/compress-texture
misc/tools/fiximage.pl
misc/tools/rebrand-darkplaces-engine.sh

index 0c6c4f0389c2619adcd24e223c543c9d83f382f9..dfc4f5a8adb0b9bf79562e5e92aa8d642f27bb7f 100755 (executable)
@@ -147,7 +147,7 @@ has_shader()
 
 has_alpha()
 {
-       [ -f "${1%.jpg}_alpha.jpg" ] || convert "$1" -depth 8 RGBA:- | xxd -c 4 -g 1 | grep -v " ff  " >/dev/null
+       [ -f "${1%.jpg}_alpha.jpg" ] || convert "$1" -auto-orient -depth 8 RGBA:- | xxd -c 4 -g 1 | grep -v " ff  " >/dev/null
 }
 
 autoshaders()
index a14b3685ed44d017c1ce0854391f2626a94d5905..e087a5a97e162d3ddc222662895ea620d572614b 100755 (executable)
@@ -28,10 +28,10 @@ name=${name%_[rlbfud][tfktpn]}
 
 echo >&2 "Order: 0=rt 1=lf 2=bk 3=ft 4=up 5=dn"
 {
-       convert "$name"_rt."$ext" -depth 8 -geometry 512x512 GRAY:-
-       convert "$name"_lf."$ext" -depth 8 -geometry 512x512 GRAY:-
-       convert "$name"_bk."$ext" -depth 8 -geometry 512x512 GRAY:-
-       convert "$name"_ft."$ext" -depth 8 -geometry 512x512 GRAY:-
-       convert "$name"_up."$ext" -depth 8 -geometry 512x512 GRAY:-
-       convert "$name"_dn."$ext" -depth 8 -geometry 512x512 GRAY:-
+       convert "$name"_rt."$ext" -auto-orient -depth 8 -geometry 512x512 GRAY:-
+       convert "$name"_lf."$ext" -auto-orient -depth 8 -geometry 512x512 GRAY:-
+       convert "$name"_bk."$ext" -auto-orient -depth 8 -geometry 512x512 GRAY:-
+       convert "$name"_ft."$ext" -auto-orient -depth 8 -geometry 512x512 GRAY:-
+       convert "$name"_up."$ext" -auto-orient -depth 8 -geometry 512x512 GRAY:-
+       convert "$name"_dn."$ext" -auto-orient -depth 8 -geometry 512x512 GRAY:-
 } | "$brightspot" /dev/stdin
index a538c70981f6ec0c7517f4f3559d3125dda0efa7..1e8f7e9c114aef13a34ba2cd58714989ff26ca54 100755 (executable)
@@ -210,7 +210,7 @@ reduce_jpeg2_dds()
        i=$1; shift
        ia=$1; shift
        o=$1; shift; shift
-       convert "$i" "$ia" -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.tga" && \
+       convert "$i" "$ia" -auto-orient -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.tga" && \
        pickdxta "$dds_tool" "$dds_sepalpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -219,7 +219,7 @@ reduce_jpeg2_dds_premul()
        i=$1; shift
        ia=$1; shift
        o=$1; shift; shift
-       convert "$i" "$ia" -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.tga" && \
+       convert "$i" "$ia" -auto-orient -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.tga" && \
        pickdxta "$dds_tool" "$dds_prealpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -229,14 +229,14 @@ reduce_jpeg2_jpeg2()
        ia=$1; shift
        o=$1; shift
        oa=$1; shift
-       if convert "$i" TGA:- | cjpeg -targa -quality "$1" -optimize -sample 1x1,1x1,1x1 > "$o"; then
+       if convert "$i" -auto-orient TGA:- | cjpeg -targa -quality "$1" -optimize -sample 1x1,1x1,1x1 > "$o"; then
                if [ "`stat -c %s "$i"`" -lt "`stat -c %s "$o"`" ]; then
                        cp "$i" "$o"
                fi
        else
                return 1
        fi
-       if convert "$ia" TGA:- | cjpeg -targa -quality "$2" -optimize -sample 1x1,1x1,1x1 > "$oa"; then
+       if convert "$ia" -auto-orient TGA:- | cjpeg -targa -quality "$2" -optimize -sample 1x1,1x1,1x1 > "$oa"; then
                if [ "`stat -c %s "$ia"`" -lt "`stat -c %s "$oa"`" ]; then
                        cp "$ia" "$oa"
                fi
@@ -251,7 +251,7 @@ reduce_jpeg2_webp()
        ia=$1; shift
        o=$1; shift; shift
        # this one MUST run
-       convert "$i" "$ia" -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.png" && \
+       convert "$i" "$ia" -auto-orient -compose CopyOpacity -composite -type TrueColorMatte "$tmpdir/x.png" && \
        cwebp $1 "$tmpdir/x.png" -o "$o"
 }
 
@@ -259,7 +259,7 @@ reduce_jpeg_jpeg()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       if convert "$i" TGA:- | cjpeg -targa -quality "$1" -optimize -sample 1x1,1x1,1x1 > "$o"; then
+       if convert "$i" -auto-orient TGA:- | cjpeg -targa -quality "$1" -optimize -sample 1x1,1x1,1x1 > "$o"; then
                if [ "`stat -c %s "$i"`" -lt "`stat -c %s "$o"`" ]; then
                        cp "$i" "$o"
                fi
@@ -289,7 +289,7 @@ reduce_rgba_dds()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       convert "$i" -type TrueColorMatte "$tmpdir/x.tga" && \
+       convert "$i" -auto-orient -type TrueColorMatte "$tmpdir/x.tga" && \
        pickdxta "$dds_tool" "$dds_sepalpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -297,7 +297,7 @@ reduce_rgba_dds_premul()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       convert "$i" -type TrueColorMatte "$tmpdir/x.tga" && \
+       convert "$i" -auto-orient -type TrueColorMatte "$tmpdir/x.tga" && \
        pickdxta "$dds_tool" "$dds_prealpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -306,12 +306,12 @@ reduce_rgba_jpeg2()
        i=$1; shift; shift
        o=$1; shift
        oa=$1; shift
-       if convert "$i" -alpha off TGA:- | cjpeg -targa -quality "$1" -optimize -sample 1x1,1x1,1x1 > "$o"; then
+       if convert "$i" -auto-orient -alpha off TGA:- | cjpeg -targa -quality "$1" -optimize -sample 1x1,1x1,1x1 > "$o"; then
                :
        else
                return 1
        fi
-       if convert "$i" -alpha extract TGA:- | cjpeg -targa -quality "$2" -optimize -sample 1x1,1x1,1x1 > "$oa"; then
+       if convert "$i" -auto-orient -alpha extract TGA:- | cjpeg -targa -quality "$2" -optimize -sample 1x1,1x1,1x1 > "$oa"; then
                :
        else
                return 1
@@ -322,7 +322,7 @@ reduce_rgb_dds()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       convert "$i" -type TrueColor "$tmpdir/x.tga" && \
+       convert "$i" -auto-orient -type TrueColor "$tmpdir/x.tga" && \
        "$meprefix"compress-texture "$dds_tool" "$dds_noalpha" "$tmpdir/x.tga" "$o" $1
 }
 
@@ -330,7 +330,7 @@ reduce_rgb_jpeg()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       if convert "$i" TGA:- | cjpeg -targa -quality "$1" -optimize -sample 1x1,1x1,1x1 > "$o"; then
+       if convert "$i" -auto-orient TGA:- | cjpeg -targa -quality "$1" -optimize -sample 1x1,1x1,1x1 > "$o"; then
                :
        else
                return 1
@@ -341,7 +341,7 @@ reduce_rgba_webp()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       convert "$i" "$tmpdir/x.png" && \
+       convert "$i" -auto-orient "$tmpdir/x.png" && \
        cwebp $1 "$tmpdir/x.png" -o "$o"
 }
 
@@ -349,7 +349,7 @@ has_alpha()
 {
        i=$1; shift; shift
        o=$1; shift; shift
-       if convert "$i" -depth 16 RGBA:- | perl -e 'while(read STDIN, $_, 8) { substr($_, 6, 2) eq "\xFF\xFF" or exit 1; } exit 0;'; then
+       if convert "$i" -auto-orient -depth 16 RGBA:- | perl -e 'while(read STDIN, $_, 8) { substr($_, 6, 2) eq "\xFF\xFF" or exit 1; } exit 0;'; then
                # no alpha
                : > "$o"
        else
index 418d8e5c40afa401ff93d9e42771008fd7708dd9..9d4fcc135eea9150de0b91996a017a2490e4dd53 100755 (executable)
@@ -50,7 +50,7 @@ esac
 
 if [ -n "$fourcchack" ]; then
        fourcchack_dir=`mktemp -d`
-       convert "$src" -fx "u*u.a" -type TrueColorMatte "$fourcchack_dir/src.$ext"
+       convert "$src" -auto-orient -fx "u*u.a" -type TrueColorMatte "$fourcchack_dir/src.$ext"
        src="$fourcchack_dir/src.$ext"
 fi
 
index 33b389ca151596b8cec3f4b0ed283830ad337b4b..8d5a7bcdf46e0d7a7c7d2274697b6d5ee27bbd27 100755 (executable)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 # Usage:
-#   convert image.tga -depth 8 RGBA:- | perl fiximage.pl 72 | convert -depth 8 -size 72x56 RGBA:- output.tga
+#   convert image.tga -auto-orient -depth 8 RGBA:- | perl fiximage.pl 72 | convert -auto-orient -depth 8 -size 72x56 RGBA:- output.tga
 
 my ($width) = @ARGV;
 
index c6d59ead1322136d3cd10e9f551c825e90db816e..105e58cdac10300ebbf93f6dee50bddf1dfa2105 100755 (executable)
@@ -73,7 +73,7 @@ for EXECUTABLE in "$@"; do
                cp "$icon_xpm" "$t/darkplaces-icon.xpm"
                cnt=
                for i in $icons_tga; do
-                       convert "$i" "$t/darkplaces-icon$cnt.tga"
+                       convert "$i" -auto-orient "$t/darkplaces-icon$cnt.tga"
                        if [ -z "$cnt" ]; then
                                cnt=2
                        else