trouble reading in an image in c++

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jfern

trouble reading in an image in c++

Post by jfern »

Hi,

I am having trouble reading in an image using c++ on unix.
I do:

try{image[0].read("menu.tif");
} catch (exception &error_ ) {
cout<<"Caught exception: " <<error.what() << endl;
}

my program compiles(makes) fine, but when I run it I get the following:

Caught exception: ImageMagick: unable to open image `menu.tif': No such file or directory
terminate called after throwing an instance of 'Magick::ErrorResourceLimit'
what(): ImageMagick: no pixels defined in cache `menu.tif'
Abort


the menu.tif is in the same directory as my .cpp file

any help would be appreciated.
Thanks,
Josh
teetanne

Re: trouble reading in an image in c++

Post by teetanne »

Dear Josh,
well, the tif file and your executable should be at the same location. Otherwise you have to use an absolute path or your take the arg[]'s from the cmd line.

greetings TeeTanne
Post Reply