Page 1 of 1

How to get the image comment back?

Posted: 2008-01-14T11:58:40-07:00
by Legenbaer
OS: WinXP + MS Visual Studio 2005
IM: 6.3.7


Hello Guys,

after solving my first problem now i´ve got a secound. ^^ I try to append a comment to the picture. This part of the story works (i can see the comment using the commandlinetool) but in C++ i don´t no how to get this comment back. I need the comment as a string-value. Please help me. :| Any ideas?

#include <Magick++.h>
#include <string>
#include <iostream>
#include <list>

using namespace std;

using namespace Magick;

int main( int argc, char ** argv)
{

// Initialize ImageMagick install location for Windows
/* InitializeMagick(*argv); */

string srcdir("");
if(getenv("SRCDIR") != 0)
srcdir = getenv("SRCDIR");
try
{
Image test;
test.read(srcdir + "smile2.png");
test.comment("blablabla");
test.verbose(); //verbose don´t show anything
test.write("smile3.png");
} catch( Exception &error_ ) {
cout << "Caught exception: " << error_.what() << endl;
return 1;
}

return 0;

}

greetings ;)

Re: How to get the image comment back?

Posted: 2008-01-14T23:45:31-07:00
by Legenbaer
Wow...it was easier than i thought:

string xyz = test.attribute("comment");

greetings