valid fields after PingImage()?

[email protected] Wed, 18 Jan 2012 12:56:46 +0000
Newsgroups gmane.comp.video.graphicsmagick.apis
Message-ID <CAGNS0RubPiQr5zPJjNF0dmDxWfjw08Zy2GwOqWSFee4mO2RrDw@mail.gmail.com>
Hi all,

I'd like to be able to ping an image, allocate a lot of structures to
hold it, then later, only when pixels are actually needed, call the
much more expensive ReadImage().

After pinging an image I can get width and height easily (of course)
but depth and number of channels seem harder to figure out. For
example, with a vanilla RGB JPG image I see:

PingImage("x.jpg"):
GetImageDepth() = 1
image->depth = 8
GetImageType() = 1
IsGrayImage() = 1
IsMonochromeImage() = 1

ReadImage("x.v"):
GetImageDepth() = 8
image->depth = 8
GetImageType() = 6
IsGrayImage() = 0
IsMonochromeImage() = 0

Looking at the code quickly it looks as if the only thing that jpeg.c
sets is ->colorspace and the only way to read this is indirectly with
GetInageType(). However GetImageType() relies on being able to create
a pixel cache, which won't work after PingImage(), only after
ReadImage().

I'm probably missing something!

This is with GM 1.3.12, the standard version on Ubuntu 11.10.

John

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d