Please, easy question for img.write

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
pepo

Please, easy question for img.write

Post 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
anotherprogrammer123
Posts: 36
Joined: 2010-02-21T18:02:40-07:00
Authentication code: 8675308

Re: Please, easy question for img.write

Post 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!
Post Reply