Unrecognized pixel map

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
magick_user

Unrecognized pixel map

Post by magick_user »

Hi all, this is my first post in this forum, and i am a newbe of image magick.
I'm using magick++ in order to get image data from a buffer in memory, but i get an exception "Unrecognized pixel map".
Fllow my code:

Code: Select all

unsigned long imageSize;
char* imageData=NULL;
unsigned long width, height;
int bitCount;

bitCount = 24;
width = 100
height = 100;
imageSize = (((width*bitCount) + 31)/32*4)*height;

imageData = new char[imageSize];

//a blank image
memset(imageData,255,sizeof(char));

std::string map("RGB");
Magick::Image image(width,height,map,MagickCore::IntegerPixel ,(void *)imageData); <-- execption throws here


In the ctor of Image class i got the exception explaied before;
Anyone can help me?
Best regards
magick_user

Re: Unrecognized pixel map

Post by magick_user »

Can anyone help me?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Unrecognized pixel map

Post by magick »

Try
  • map.c_str()
The MagickCore methods require C strings, not C++ strings.
magick_user

Re: Unrecognized pixel map

Post by magick_user »

Same result. Nothing to do.
It is strange, but the message is:

"ImageMagick-6.5.5-Q16: Unrecognozed pixel map ΄ÌÌÌÌRGB' @pixel.c/Import imagePixels/1815"

Appear that for some reason, it prepend some extra character.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Unrecognized pixel map

Post by magick »

We're using ImageMagick 6.5.5-4, the current release, and your code does not produce an exception for us. We're not sure why its failing for you.
magick_user

Re: Unrecognized pixel map

Post by magick_user »

That's all?
Anyone can help me?
Any idea?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Unrecognized pixel map

Post by magick »

We have proven your code works which means the problem is not within ImageMagick but a problem with your compiler, linker, or project settings. If you are working under Windows, transfer your code to the Button project located in c:\Program Files\ImageMagick-6.5.5-4\Magick++_Demos. It has the proper settings to ensure your code will compile and run properly.
magick_user

Re: Unrecognized pixel map

Post by magick_user »

Solved.
Tanks.
Best regards
Post Reply