Gray to tiff does not preserve depth
Posted: 2010-05-31T21:59:17-07:00
On openSUSE 11.2, using ImageMagick 6.5.4-8 or svn revision 2052.
I have some grayscale images stored as arrays of shorts which I would like to convert to tiff files. However, I have found that the depth of the tiff files created by ImageMagick is 1, rather than 16. Sample command:
convert -size 512x512 -depth 16 gray:test.dat test.tiff
(test.dat can be found at http://rapidshare.com/files/393886626/test.dat.html. The range of intensities is small, but we often use ImageJ for viewing and thus the scaling is performed automatically.)
Conversion to other formats (png, for example) does preserve the depth of the original gray image. Also, converting an image from png to gray to tiff preserves the depth, but tiff to gray to tiff fails:
convert -size 512x512 -depth 16 gray:test.dat good.png
convert -size 512x512 -depth 16 gray:test.dat ppm:- | convert ppm:- good.tiff
convert good.tiff gray:- | convert -depth 16 -size 512x512 gray:- bad.tiff
Is there something about the tiff format that I am missing, or is this a bug in ImageMagick itself? Thanks for any help.
I have some grayscale images stored as arrays of shorts which I would like to convert to tiff files. However, I have found that the depth of the tiff files created by ImageMagick is 1, rather than 16. Sample command:
convert -size 512x512 -depth 16 gray:test.dat test.tiff
(test.dat can be found at http://rapidshare.com/files/393886626/test.dat.html. The range of intensities is small, but we often use ImageJ for viewing and thus the scaling is performed automatically.)
Conversion to other formats (png, for example) does preserve the depth of the original gray image. Also, converting an image from png to gray to tiff preserves the depth, but tiff to gray to tiff fails:
convert -size 512x512 -depth 16 gray:test.dat good.png
convert -size 512x512 -depth 16 gray:test.dat ppm:- | convert ppm:- good.tiff
convert good.tiff gray:- | convert -depth 16 -size 512x512 gray:- bad.tiff
Is there something about the tiff format that I am missing, or is this a bug in ImageMagick itself? Thanks for any help.