Page 1 of 1

mogrify automatically converts some images to grayscale

Posted: 2012-01-30T20:07:29-07:00
by akoumjian
Hello,

I resized a bunch of directories with mogrify using the following command:

Code: Select all

find . -name "*.png" -exec mogrify -resize 23.916% {} \;
Some of the images were changed from RGB to grayscale, and in the process suffered a color shift. They were mostly grayscale, but must not have been completely so because they look different now. My question is, how does mogrify determine it should change the color mode? Secondly, how do I prevent this?

Re: mogrify automatically converts some images to grayscale

Posted: 2012-01-30T20:10:59-07:00
by fmw42
what version of IM are you using?

can you post a link to at least one such image that suffers a change of color so others can test it.

does it happen when you use convert on any one image?

Re: mogrify automatically converts some images to grayscale

Posted: 2012-01-31T07:24:47-07:00
by anthony
The PNG coder automatically uses the smallest PNG type needed to hold the image

If an image only uses grayscale values it will save it as greyscale.

You can prevent this with a special coder -define... See
http://www.imagemagick.org/Usage/formats/#png_write