Hi all.
I am trying to convert 16 bit greyscale tiff to 16 bit png with: "convert infile.tif -depth 16 outfile.png". This works correctly only the png file includes all three (RGB) channels (48 bit). Is it possible to write only one channel with IM or do I have to use another program?
Searching the forum I found this thread: http://redux.imagemagick.org/discourse- ... 16+bit+png for the same problem but without any solution. I have looked at the documentation and tried various approaches but without success.
I have installed ImageMagick 6.4.0 04/04/08 Q16 on Windows.
Thanks in advance,
Nicolai
Converting 16 bit tiff to 16 bit png (greyscale)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting 16 bit tiff to 16 bit png (greyscale)
Are you on a 16-bit version of IM? If so, try
convert infile.tif -depth 16 -type Grayscale outfile.png
I am not sure that -depth is needed if you are on a 16-bit IM? You could also try
convert infile.tif -type Grayscale outfile.png
If this does not work, first check that your tif file is truly grayscale (no differences in channel grayscale values). Verify using
convert infile.tif -verbose info:
and
convert outfile.png -verbose info:
If this is all true and you still cannot get a single channel output and you are sure PNG supports that kind of image, then report this to the Bugs forum
convert infile.tif -depth 16 -type Grayscale outfile.png
I am not sure that -depth is needed if you are on a 16-bit IM? You could also try
convert infile.tif -type Grayscale outfile.png
If this does not work, first check that your tif file is truly grayscale (no differences in channel grayscale values). Verify using
convert infile.tif -verbose info:
and
convert outfile.png -verbose info:
If this is all true and you still cannot get a single channel output and you are sure PNG supports that kind of image, then report this to the Bugs forum
Re: Converting 16 bit tiff to 16 bit png (greyscale)
Thank you very much fmw42. It appears to work. I feel a bit dumb I didn't see that switch before
The images .tif and .png appears identical when checked with 'compare -metric ae infile.tif outfile.png diff.png' and 'identify -format %k%' reports the same number of unique pixels for the .tif and .png images.
I found out that -type Grayscale and -type Optimize produces the same result.
For some reason the .png image (1.441.440 bytes) is slightly larger than the .tif (1.212.944 bytes) with '-quality 100'. That part I don't quite understand as both are lossless and zip compressed.
The images .tif and .png appears identical when checked with 'compare -metric ae infile.tif outfile.png diff.png' and 'identify -format %k%' reports the same number of unique pixels for the .tif and .png images.
I found out that -type Grayscale and -type Optimize produces the same result.
For some reason the .png image (1.441.440 bytes) is slightly larger than the .tif (1.212.944 bytes) with '-quality 100'. That part I don't quite understand as both are lossless and zip compressed.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting 16 bit tiff to 16 bit png (greyscale)
With regard to the file sizes, I don't know the answer. You will have to asked the IM folks. The only thing I can think of is different amount of data in the headers. You could try adding -strip to strip the profiles and other header data and see if they both end up the same. But I suspect there are header data that cannot be stripped and each format has a different amount of header info.