-depth option not working for tiff images

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jdccdevel

-depth option not working for tiff images

Post by jdccdevel »

I am unable to generate tif files with 8bit samples using 6.5.1.0 This was working using version 6.4.8.3

converting to a png correctly recognizes the -depth option.

This problem was also present before 6.5.1, in 6.4.2 (I think) so this is a definite regression.

$ convert --version
Version: ImageMagick 6.5.1-0 2009-05-05 Q16 HDRI OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

$ identify hrp_blur.tif
hrp_blur.tif TIFF 5100x6600 5100x6600+0+0 32-bit Grayscale DirectClass 128.5mb

$ convert hrp_blur.tif -depth 8 hrp_blur1-a.tif
$ identify hrp_blur1-a.tif
hrp_blur1-a.tif TIFF 5100x6600 5100x6600+0+0 32-bit Grayscale DirectClass 128.5mb

$ convert hrp_blur.tif -depth 8 hrp_blur1-a.png
$ identify hrp_blur1-a.png
hrp_blur1-a.png PNG 5100x6600 5100x6600+0+0 8-bit DirectClass 2.19mb
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -depth option not working for tiff images

Post by magick »

TIFF supports the HDRI format which by default is floating point @ 32-bit. To force 8-bit use this command:
  • convert hrp_blur.tif -depth 8 -define quantum:format=unsigned hrp_blur1-a.tif
jdccdevel

Re: -depth option not working for tiff images

Post by jdccdevel »

magick wrote:TIFF supports the HDRI format which by default is floating point @ 32-bit. To force 8-bit use this command:
  • convert hrp_blur.tif -depth 8 -define quantum:format=unsigned hrp_blur1-a.tif
Thank you, I have tested this, and it works.

However, this is still a bug, as "-depth 8" is sufficient to force 8 bit on any other image format, and there is no such thing as "floating point @ 8 bit"

Setting "-depth 8" should imply "quantum:format=unsigned", as it is the only reasonable format at that bit depth.

Silently ignoring the option is doing completely the wrong thing. If nothing else, it should be generating an error or a warning.

Also note: Even though HDRI is defined in my install, the default behavior should stay the same as non HDRI versions. As it is, any non-hdri aware tools using imagemagick will be creating tiff images unreadable by many other programs. This is especially important given the plethora of tools using tiff as an interchange format (for OCR, barcode reading, etc)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -depth option not working for tiff images

Post by magick »

Ok, we'll work up a patch for the next point release. Thanks.
jdccdevel

Re: -depth option not working for tiff images

Post by jdccdevel »

Thank you.

I must say, I am very impressed with the speed of your replies. It is very refreshing to be dealing with someone so professional.

I look forward to the next point release! :D
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -depth option not working for tiff images

Post by magick »

Grab ImageMagick-6.5.2-2 from ftp://magick.imagemagick.org/pub/ImageMagick/beta or ftp://magick.imagemagick.org/pub/ImageMagick. Let us know if it fixes the problem you reported.
jdccdevel

Re: -depth option not working for tiff images

Post by jdccdevel »

Yes, 6.5.2.2 seems to fix the problem.

Thanks.

8)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -depth option not working for tiff images

Post by magick »

8-bits is per pixel component. If you want a colormapped image instead, add -colors 256 to your command line. If you want a grayscale image, add -type grayscale to your command line.
Post Reply