Page 1 of 1

-depth operator has no effect

Posted: 2018-05-03T09:47:11-07:00
by user001
I am using a Q64 version of ImageMagick, and am trying to work with an image at 16-bit instead of 64-bit depth. At 64-bit depth, the pixel values span the 64-bit range (0 to 1.84E19); however, if I use `-depth 16` with the intention of rescaling the pixel values to the 16-bit range (0-65,535), I find that it has no effect. Is there any way to adjust the depth of the image held in working memory? Thank you.

Code: Select all

$ magick image.tif           -format "min=%[min]    mean=%[mean]    max=%[max]\n" info:
min=1.43554e+16    mean=6.58373e+18    max=1.84467e+19

$ magick image.tif -depth 16 -format "min=%[min]    mean=%[mean]    max=%[max]\n" info:
min=1.43554e+16    mean=6.58373e+18    max=1.84467e+19

$ magick --version
Version: ImageMagick 7.0.7-2 Q64 x86_64 2017-09-13 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP 
Delegates (built-in): bzlib fftw fontconfig freetype jng jpeg lzma pangocairo png tiff x xml zlib

Re: -depth operator has no effect

Posted: 2018-05-03T10:17:18-07:00
by snibgo
"-depth N" is mostly for setting the output format, eg to save the image in a TIFF in 8 or 16 bits/channel or whatever.

If you use Q64 and you want to scale to 0-65535, then divide by (2^64)-1 and multiply by 65535. This is equivalent to dividing by 281479271743489.

Re: -depth operator has no effect

Posted: 2018-05-03T10:20:55-07:00
by user001
Thanks.