Page 1 of 1

Accessing image attributes?

Posted: 2011-04-14T10:54:47-07:00
by treaves
I'm trying to access the information about an image; basically the stuff that gets printed to stdout from identify -verbose. Specifically, from this snippit:

Code: Select all

  Background color: black
  Compression: Zip
  Properties:
    date:create: 2011-04-14T12:51:38-04:00
    date:modify: 2011-04-14T12:51:38-04:00
    signature: 9009779e2dfcdc01f7cfd8a60cb1532d20e5e731a4d48ab141960dcffdfcbcd0
    tiff:document: 010428TG16-583001.tif
    tiff:photometric: min-is-black
    tiff:rows-per-strip: 23
    tiff:software: ImageMagick 6.6.0-9 %F Q16 http://www.imagemagick.org
I'd like to be able to access the background color and the tiff:photometric value. Now, I know I can get the background color with the backgroundColor() method on Image, but, I've not been able to figure out the photometric data.

Anyone know how to do this?

Re: Accessing image attributes?

Posted: 2011-04-14T11:00:11-07:00
by magick
Use image.attribute('tiff:document), for example, to get the TIFF:DOCUMENT property as a std::string.

Re: Accessing image attributes?

Posted: 2011-04-14T11:13:03-07:00
by treaves
Oddly, image..backgroundColor().to_std_string() always returns #FFFFFFFFFFFF regardless of the actual background of the image.

Re: Accessing image attributes?

Posted: 2011-04-14T11:16:27-07:00
by treaves
magick wrote:Use image.attribute('tiff:document), for example, to get the TIFF:DOCUMENT property as a std::string.
Thanks, that's it. Now if I can only figure out why backgroundColor is returning what it is...