Hello,
I would like to save a image in tiff or bmp format, with 1bit by pixel.
For the moment i use OF_IMAGE_GRAYSCALE format which have 8bit by pixel.
card.allocate(img.getWidth(), img.getHeight(), OF_IMAGE_GRAYSCALE);
Any idea ?
Thank
Hello,
I would like to save a image in tiff or bmp format, with 1bit by pixel.
For the moment i use OF_IMAGE_GRAYSCALE format which have 8bit by pixel.
card.allocate(img.getWidth(), img.getHeight(), OF_IMAGE_GRAYSCALE);
Any idea ?
Thank
not image…
Thanks Tsin,
but is not a very explicit answer
My question was :
Is it possible to save an image with 1bpp ?
I would love to know about that too
Finally I used easyBMP library.
Here my function :
static void saveToBitmap1BitByPixel(ofImage &img, string absolutePath){
BMP bmp;
//save in BMP 1 bit depth
bmp.SetSize(img.getWidth(), img.getHeight());
bmp.SetBitDepth(1);
RGBApixel px;
for(int y=0; y<img.getHeight(); y++){
for(int x=0; x<img.getWidth(); x++){
px.Red = img.getColor(x, y).r;
px.Green = img.getColor(x, y).g;
px.Blue = img.getColor(x, y).b;
bmp.SetPixel(x, y, px);
}
}
char pp[1024];
strcpy(pp, absolutePath.c_str());
bmp.WriteToFile(pp);
};
Hope that can be help