Why %[bit-depth] is sometimes 8 and sometimes 16 for indexed tiff?
Posted: 2018-03-21T23:57:12-07:00
First I create a 2 color indexed tiff via png.
Second, I created another one directly:
Colors are different but I do not care it for now. The point is both are 1-bit indexed tiff. They have same size (as I specified no compression) and seems to have correct 16-bit colormap.
However identify reports different value for bit-depth:
Please let me suggest if I missed something, or let me know how bit-depth are determined by ImageMagick.
Best Wishes,
Here is the version of ImageMagick that comes with MSYS2 on Windows.
Code: Select all
$ magick logo: -colors 2 -define png:include-chunk=none -define png:bit-depth=1 -define png:color-type=3 logo1.png
$ magick logo1.png -compress none logo1.tif
$ identify -verbose logo1.tif | grep -A 2 -B 5 -i colormap:
Colors: 2
Histogram:
42971: ( 83, 62, 82) #533E52 srgb(83,62,82)
264229: (253,253,253) #FDFDFD srgb(253,253,253)
Colormap entries: 2
Colormap:
0: (253,253,253,255) #FDFDFDFF srgba(253,253,253,1)
1: ( 83, 62, 82,255) #533E52FF srgba(83,62,82,1)
Code: Select all
$ magick logo: -type palette -depth 1 -colors 2 -compress none logo2.tif
$ identify -verbose logo2.tif | grep -A 2 -B 5 -i colormap:
Colors: 2
Histogram:
38008: ( 63, 33, 84) #3F2154 srgb(63,33,84)
269192: (255,255,255) #FFFFFF white
Colormap entries: 2
Colormap:
0: (255,255,255,255) #FFFFFFFF white
1: ( 63, 33, 84,255) #3F2154FF srgba(63,33,84,1)
Code: Select all
$ identify *.tif
logo1.tif TIFF 640x480 640x480+0+0 1-bit sRGB 2c 38682B 0.000u 0:00.001
logo2.tif TIFF 640x480 640x480+0+0 1-bit sRGB 2c 38682B 0.000u 0:00.000
$ tiffdump.exe logo1.tif | grep -i colormap
Colormap (320) SHORT (3) 6<65021 21331 65021 15934 65021 21074>
$ tiffdump.exe logo2.tif | grep -i colormap
Colormap (320) SHORT (3) 6<65535 16251 65535 8547 65535 21646>
Code: Select all
$ identify -format '%[depth]/%[bit-depth]\n' logo1.tif logo2.tif
1/8
1/16
Best Wishes,
Here is the version of ImageMagick that comes with MSYS2 on Windows.
Code: Select all
$ magick -version
Version: ImageMagick 7.0.6-7 Q16 x86_64 2017-08-16 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf xml zlib