Magick++ API working with monochome Bitmaps
Posted: 2017-10-09T01:27:19-07:00
Hi there,
I was looking for a library which compiles under linux and which is capable of dealing with text and graphics, as well as supporing monochrome bitmaps (1Bit depth). In addition, the API should provide a way to directly access RAW Bitmap buffer. Currently I'm evaluating ImageMagick concerning those criterias and I experienced some problems...
I was looking for a library which compiles under linux and which is capable of dealing with text and graphics, as well as supporing monochrome bitmaps (1Bit depth). In addition, the API should provide a way to directly access RAW Bitmap buffer. Currently I'm evaluating ImageMagick concerning those criterias and I experienced some problems...
- I created a monochrome image but after painting on it, using a Drawable Object, the color-depth changes to 8Bit. Please see following code:
What am I doing wrong here. I want to stay in 1Bit monochrome colorspace.Code: Select all
#include <Magick++.h> using namespace Magick; int main(int argc, char **argv) { InitializeMagick(*argv); Image image(Geometry(100, 100), "black"); image.colorSpace(GRAYColorspace); image.depth(1); image.type(BilevelType); // Set draw options image.strokeColor("white"); image.fillColor("white"); image.strokeWidth(5); printf("Before:\n Bit-depth: %ld\n Image-Type: %d\n Color-Space: %d\n", image.depth(), image.type(), image.colorSpace()); image.write("image-before-drawable.bmp"); // Draw on image image.modifyImage(); image.draw(DrawableRectangle(20, 10, 50, 50)); image.write("image-after-drawable.bmp"); // Read back and output image properties Image image2; image2.read("image-after-drawable.bmp"); printf("After:\n Bit-depth: %ld\n Image-Type: %d\n Color-Space: %d\n", image.depth(), image.type(), image.colorSpace()); return 0; }
- Is there a way to access the image data in raw format? (one bit corresponds to one pixel)