Page 1 of 1

-depth option not working for tiff images

Posted: 2009-05-05T17:21:18-07:00
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

Re: -depth option not working for tiff images

Posted: 2009-05-05T18:28:53-07:00
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

Re: -depth option not working for tiff images

Posted: 2009-05-06T08:22:24-07:00
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)

Re: -depth option not working for tiff images

Posted: 2009-05-06T08:54:20-07:00
by magick
Ok, we'll work up a patch for the next point release. Thanks.

Re: -depth option not working for tiff images

Posted: 2009-05-06T09:42:58-07:00
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

Re: -depth option not working for tiff images

Posted: 2009-05-06T09:48:46-07:00
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.

Re: -depth option not working for tiff images

Posted: 2009-05-06T10:46:04-07:00
by jdccdevel
Yes, 6.5.2.2 seems to fix the problem.

Thanks.

8)

Re: -depth option not working for tiff images

Posted: 2009-05-12T07:42:20-07:00
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.