UnrecognizedPixelMap Exception when creating Image

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
criskross
Posts: 7
Joined: 2013-01-11T04:24:34-07:00
Authentication code: 6789

UnrecognizedPixelMap Exception when creating Image

Post by criskross »

Hello,

I get the following exception when I try to create an instance of Image:

Code: Select all

try {
    Image mgk(iplImage->width, iplImage->height, "BGR", CharPixel, (char*)iplImage->imageData );	
    return mgk;
} catch (Error e) {
    cout << e.what() << endl;
}
UnrecognizedPixelMap ` ¶BGR' @ error/pixel.c/ImportImagePixels/3713"

I'm using Windows 7 with MSVC2010. Do I have to change any settings withi MSVC?

I already tried c_str() and also string
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: UnrecognizedPixelMap Exception when creating Image

Post by magick »

It looks like a structure skew which can come from incorrect compile settings. To start with a sane workspace, go to c:\Program Files\ImageMagick-6.8.1-Q16/Magick++_demos and click on the button workspace, build and execute. If all goes well, you can use that workspace as a template for your own custom codeset.
criskross
Posts: 7
Joined: 2013-01-11T04:24:34-07:00
Authentication code: 6789

Re: UnrecognizedPixelMap Exception when creating Image

Post by criskross »

Ok same answer again.

Somewhere is the problem. Don't you know which setting to change? I am using CMake and I don't want to use button as a template.

I checked your solution but the executable crashes...
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: UnrecognizedPixelMap Exception when creating Image

Post by magick »

Not sure why its failing for you, we did a fresh install on 3 Windows systems of ImageMagick-6.8.1-9-Q16 and compiled and ran the button workspace. It compiled and ran without complaint.
criskross
Posts: 7
Joined: 2013-01-11T04:24:34-07:00
Authentication code: 6789

Re: UnrecognizedPixelMap Exception when creating Image

Post by criskross »

I think there is a bug in your function. I enter a string with three chars "BGR" and the errormessage returns ` ¶BGR' ? There is definitively something wrong.

For the future: I think u better should use enums for cases like this....

Of course the exception is right but I didn't commited a string like the exception says
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: UnrecognizedPixelMap Exception when creating Image

Post by magick »

That indicates a mismatch on the function stack which can be caused by improper compile / linking parameters. On our system, we get "BGR" as expected.
criskross
Posts: 7
Joined: 2013-01-11T04:24:34-07:00
Authentication code: 6789

Re: UnrecognizedPixelMap Exception when creating Image

Post by criskross »

OK, for those who had the same problem. I think i found the solution.

If u use CMake as a buildtool and try to find ImageMagick there only will be linked the release libraries. That was the problem when I run my program MSVC used the release dll instead of the debug dll in debug mode. So I modified the FindImageMagick.cmake to also search for debug libraries.
Post Reply