image.attribute invalid argument

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
ralph058
Posts: 1
Joined: 2016-03-03T11:31:43-07:00
Authentication code: 1151

image.attribute invalid argument

Post by ralph058 »

Hi
I am attempting to use Magick++ image.attribute("Lens:") to extract the same string as is displayed with

identify -verbose L_Cam_1263.png | grep "Lens:"

I believe the c++ code that I need is

string metaLens;
InitializeMagick("");
Magick::Image imgMeta(imageFileName);
metaLens = imgMeta.attribute("Lens:");
cout << "string focal length = " << metaLens << endl;

where imageFileName contains a string with the full path to L_Cam_1263.png (and others as called in sequence). I am not sure if the output is supposed to be the string "Lens: 5.46" or "5.46". So, I have commented out everything after the cout line.

The printout is
string focal length =

With no value for the string metaLens.

The compiler does not show an error, but Eclipse shows a wavy red underline, which means a problem and the mouse over shows

Invalid arguments '
Candidates are:
void attribute(?, ?)
? attribute(?)
'
The source for Magick::Image::attribute shows the declaration (at line 2036) of and the return is value
std::string Magick::Image::attribute(const std::string name_) const

what is wrong here. Is this some funky Eclipse problem? The include paths and linking is correct or I would have problems with the other artifacts from Magick++. C++11 is properly set or I would have problems with 'stof' (elsewhere in the program).
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: image.attribute invalid argument

Post by snibgo »

Try it without the colon, ie "Lens".
snibgo's IM pages: im.snibgo.com
Post Reply