Re: Dealing with MONO12 images in memory

Bob Friesenhahn <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Wed, 22 Nov 2017, Robert H. Olsen wrote:
> 
>    gmimage.read(blob,Geometry(arv_width, arv_height),"GRAY");
>    gmimage.depth(16);
>    gmimage.endian(LSBEndian);

The above is coded in reverse order.  The depth and endian properties 
are needed at the read step.  Without this you are using defaults.

> The third style of read (commented out with "//$") resulted in a black looking image, until I added normalize,
> and then the image actually looked good!  But I think something is probably still wrong, because the image
> depth is still reported as 8, and the displayed image's info says it has only 256 values, so only 8 bits deep.

Make sure that the QuantumDepth value used by your GraphicsMagick 
build is 16 or 32.

There is something to know about depth() in that due to my own 
stupidity it is both a setting and an algorithm.  At the C level there 
is an Image 'depth' attribute which is just a setting.  However, when 
you invoke the Image depth() method with existing pixels it will 
reduce the effective depth to the depth specified, and when it is 
called it will study the existing pixels and see what minimum depth is 
required to store them without loss.  A totally black or white image 
will likely report a depth of 1.

> Is there some other way of specifying the image depth for a GRAY image?  Am I doing something else wrong?  Any
> suggestions for other things to try?  My users are physicists who are interested in lossless images with the
> full dynamic range available.

Just make sure that depth was specified prior to doing the read (which 
invokes code in a coder module).

> Once again, I really appreciate your help with this.  I am looking forward to getting beyond this and trying
> some of the other graphicsmagick features.

You are really close to success!

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Graphicsmagick-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.