mogrify automatically converts some images to grayscale

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
akoumjian
Posts: 1
Joined: 2012-01-30T20:03:19-07:00
Authentication code: 8675308

mogrify automatically converts some images to grayscale

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mogrify automatically converts some images to grayscale

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: mogrify automatically converts some images to grayscale

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply