Accessing image attributes?

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
treaves
Posts: 12
Joined: 2011-04-14T10:48:35-07:00
Authentication code: 8675308

Accessing image attributes?

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Accessing image attributes?

Post by magick »

Use image.attribute('tiff:document), for example, to get the TIFF:DOCUMENT property as a std::string.
treaves
Posts: 12
Joined: 2011-04-14T10:48:35-07:00
Authentication code: 8675308

Re: Accessing image attributes?

Post by treaves »

Oddly, image..backgroundColor().to_std_string() always returns #FFFFFFFFFFFF regardless of the actual background of the image.
treaves
Posts: 12
Joined: 2011-04-14T10:48:35-07:00
Authentication code: 8675308

Re: Accessing image attributes?

Post 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...
Post Reply