Image colorspace: Unterschied zwischen den Versionen

Aus Fachinformatiker Azubi
Zur Navigation springen Zur Suche springen
 
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt)
Zeile 8: Zeile 8:
 
  or
 
  or
 
  identify -verbose file.jpg | grep Colorspace
 
  identify -verbose file.jpg | grep Colorspace
 +
 +
== Script ==
 +
 +
<pre>
 +
#!/bin/bash
 +
 +
echo "Checking jpg files..."
 +
expected="sRGB"
 +
 +
for f in *.jpg;
 +
do
 +
        colorspace=`identify -verbose $f | grep Colorspace | cut -d" " -f4`
 +
 +
#echo $colorspace;
 +
 +
        if [ $colorspace != $expected ]
 +
        then
 +
                echo "Bad file found: $f - $colorspace";
 +
        fi
 +
done;
 +
 +
echo "end"
 +
</pre>
  
 
== Note ==
 
== Note ==
  
 
* https://www.phpimagick.com/Imagick/transformImageColorspace
 
* https://www.phpimagick.com/Imagick/transformImageColorspace
 +
 +
find . -iname "*.jpg" -exec jpeginfo -c {} \; | grep -E "Unsupported color conversion request"
 +
find . -iname "*.jpg" -exec file {} \; | grep -e "CMYK" | cut -d" " -f1

Aktuelle Version vom 31. Januar 2019, 12:42 Uhr

Get Colorspace

On Mac OS X

sips -g space file.jpg

On Linux:

identify -format '%[colorspace]' file.jpg
or
identify -verbose file.jpg | grep Colorspace

Script

#!/bin/bash

echo "Checking jpg files..."
expected="sRGB"

for f in *.jpg;
do
        colorspace=`identify -verbose $f | grep Colorspace | cut -d" " -f4`

#echo $colorspace;

        if [ $colorspace != $expected ]
        then
                echo "Bad file found: $f - $colorspace";
        fi
done;

echo "end"

Note

find . -iname "*.jpg" -exec jpeginfo -c {} \; | grep -E "Unsupported color conversion request"
find . -iname "*.jpg" -exec file {} \; | grep -e "CMYK" | cut -d" " -f1