Problem writing B&W image data

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
danicb2
Posts: 1
Joined: 2012-04-27T00:31:48-07:00
Authentication code: 13

Problem writing B&W image data

Post by danicb2 » 2012-04-27T00:43:37-07:00

Hi,

I'm trying to write the image data of an Image object into a char array. My code looks like the following:

Code: Select all

char* block  = (char*)malloc(widthTV*heightTV);
mgkim.write(0,0,widthTV,heightTV,"RGB",CharPixel,block);
The problem is that my image is a 1-channel black & white image so the map parameter "RGB" won't work. The documentation says that I can only use a combination of "R", "G", "B", "A", "C", "Y", "M" and "K" and I don't know what I should do when I have a B&W image. I tried to give only "R" or "K" but I get a wrong result (my image gets replicated 16 times in the width*height frame).

Is there any solution for this? Am I missing something?

Thanks in advance,

Dani.

Post Reply