Tomasso
Tomasso

Reputation: 711

ImageMagick convert grayscale tif to grayscale png not working

I want to convert a tif grayscale image to png grayscale image with ImageMagick 'convert' utility (ImageMagick 6.9.7-4). The input file Extravert.tif has the following characteristics:

identify Extravert.tif
Extravert.tif TIFF 1113x1450 1113x1450+0+0 32-bit Grayscale Gray 6.468MB 0.010u 0:00.009

I tried using convert -grayscale option as follows:

convert Extravert.tif -grayscale Brightness  Extravert.png

But the resulting output image is not grayscale:

 identify Extravert.png
Extravert.png PNG 1113x1450 1113x1450+0+0 8-bit sRGB 2c 601B 0.000u 0:00.000

I also tried solutions suggested in this post, but still the output png is sRGB not grayscale.

How can I preserve the grayscale when converting from tif to png?

Extravert.tif (input), Extravert.png (output)

Thanks Tom

Upvotes: 1

Views: 617

Answers (1)

fmw42
fmw42

Reputation: 53202

I think your ImageMagick version 6.9.7.4 may be buggy or -grayscale was not fully developed by your version.

I cannot seem to get to your exact images at this time. Is there a problem with posting TIFs to Google Drive?

So I made an example. The following works fine for me on IM 6.9.10.63 Q16 Mac OSX.

convert logo: -colorspace gray logo.tif
identify logo.tif
logo.tif TIFF 640x480 640x480+0+0 8-bit Grayscale Gray 33344B 0.000u 0:00.000

convert logo.tif -grayscale brightness logo.png
identify logo.png
logo.png PNG 640x480 640x480+0+0 8-bit Gray 256c 32041B 0.000u 0:00.000

Can you upgrade your version of ImageMagick or get a more current patch. Note that sometimes Linux distributions only patch for security bugs. So that could possibly explain why your version does not work.

Upvotes: 1

Related Questions