-depth operator has no effect

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
user001
Posts: 30
Joined: 2015-11-02T01:21:03-07:00
Authentication code: 1151

-depth operator has no effect

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -depth operator has no effect

Post 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.
snibgo's IM pages: im.snibgo.com
user001
Posts: 30
Joined: 2015-11-02T01:21:03-07:00
Authentication code: 1151

Re: -depth operator has no effect

Post by user001 »

Thanks.
Post Reply