Page 1 of 1

Problem writing B&W image data

Posted: 2012-04-27T00:43:37-07:00
by danicb2
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.