Page 1 of 1

Magick++: Get image attributes

Posted: 2015-06-29T16:17:00-07:00
by olear
Hi, I need to get some image info from a PSD. I have tested 'identify' and the data I need is present, but how can I get this info using Magick++?

I know about the attribute() function, but the info I need is empty, or I don't know the right attribute "command".

Example:

Code: Select all

image.read("somefile.psd[some layer]"); // also tried without layer
std::cout << image.attribute("tiff:XResolution") << std::endl; // ok
std::cout << image.attribute("tiff:YResolution") << std::endl; // ok
std::cout << image.attribute("psd:layer.opacity") << std::endl; // empty
std::cout << image.attribute("psd:layer.x") << std::endl; // empty
std::cout << image.attribute("psd:layer.y") << std::endl; // empty
Output is:

Code: Select all

300
300

Output from identify:

Code: Select all

    tiff:XResolution: 300
    tiff:YResolution: 300
    psd:layer.opacity: 2408550287
    psd:layer.x: 61
    psd:layer.y: 33
The tiff stuff works, but not the rest. I also need to get the 'Scene:' and 'Compose:' attribute, but don't know the "command" for that.

Sorry if this is a stupid question :)