How to identify if an image have an embed sRGB icc profile?

1.3k views Asked by At

I would like to remove from my images their sRGB profile if they have one. the problem i don't know how to identify that an image have a sRGB profile. What the good way to do ?

2

There are 2 answers

3
fmw42 On BEST ANSWER

In Imagemagick, use

convert image.suffix -format "%[profiles]\n" info:

or

convert image.suffix -format "%[profile:icc]\n" info:

unless your Imagemagick version is ancient.

For example:

convert logo.jpg  -format "%[profiles]\n" info:
icc


convert logo.jpg  -format "%[profile:icc]\n" info:
sRGB built-in
0
Mark Setchell On

Please do not accept as the answer as Fred has already shown you the way, but here's how you can get the profile with PHP Imagick:

$img = new Imagick('image.jpg');
$img->setOption('format','%[profiles]');
$img->setImageFilename('info:');

$fd = fopen('php://memory','rwb');
$img->writeImageFile($fd);
fseek($fd, 0);
$info = fread($fd, 1024);
fclose($fd);
var_dump($info);

Sample Output

string(18) "app12,exif,icc,xmp"