Page 1 of 1

Please, easy question for img.write

Posted: 2010-05-30T10:58:18-07:00
by pepo
Hi everyone,

Im starting with Magick++, and I have to solve a problem for my University project,

I need to convert my output with all these characteristics:
1. Monochrome
2. File Format: .TIF
3. Canvas Size: 5.26 mm x 2.31 mm
4. Portraying as many levels of gray as possible using monochromatic pixels
5. Image mode: Bitmap
6. Resolution: 200 dpi

Ive achieved some,

Image img;
img.read("img.jpg");
img.type( GrayscaleType );
img.monochrome(); // Condition 1?
img.magick("TIF"); //Condition 2?
img.resolutionUnits(PixelsPerInchResolution);
img.density(Geometry(200,200)); //Condition 6?
img.write("out.tif");

Im not if im doing well....please a beg for your help, its for my University project....I have no idea how to achieve conditions 3, 4 and 5....

Thank you very much

Anna

Re: Please, easy question for img.write

Posted: 2010-06-16T13:06:57-07:00
by anotherprogrammer123
Hi,

Code: Select all

img.type( BilevelType); //CHANGED
img.monochrome(true); // CHANGED
img.magick("TIF"); //YES, GOOD!
img.magick("TIF"); //YES, GOOD!
image.compressType(MagickLib::Group4Compression); //GROUP 4 COMPRESSION IS BEST FOR YOUR SITUATION
4. Try using img.quantize() on some test images
5. What do you mean?
6. I think you need to do some math to get this. Also, note that dpi is dependent on the paper size (US Legal? A4?)

Hope that helps!