Page 1 of 1

imitating the -density operator

Posted: 2008-03-02T02:36:47-07:00
by mkoppanen
I got a question from user which I am unable to answer without diving into the ImageMagick sources:

"Using the console typing: “convert -density 300×300 /home/timo/test.pdf[1] test.jpg” leads to an internal rendering process that fetches the informations (vectors, fonts, pictures etc.) with 300dpi. How is this possible with IMagick without a loss of quality?"

I thought roughly the same in MagickWand would be:

Code: Select all

MagickWand *wand = NewMagickWand();

MagickSetResolution( wand, 300, 300 );

MagickReadImage( wand, "test.pdf" ); 
Is that correct ?

Re: imitating the -density operator

Posted: 2008-03-02T08:12:31-07:00
by el_supremo
Hi Mikko,

You might need

Code: Select all

MagickSetImageResolution( wand, 300, 300 );
Pete

Re: imitating the -density operator

Posted: 2008-03-02T08:52:24-07:00
by mkoppanen
Hi Pete and thanks for the quick reply.

Wouldn't I use

Code: Select all

MagickSetResolution( wand, 300, 300 );
to set the resolution before the actual read occurs? If I remember correctly that is required with for example RAW images(?). What I hear from the users is that SetImageResolution or SetResolution does not do exactly the same as the -density operator. That's why I am wondering..

Re: imitating the -density operator

Posted: 2008-03-02T14:17:56-07:00
by el_supremo
I've had a quick peek at the code and, if I read it correctly, MagickSetResolution does the same as the -density switch - e.g. image_info->density="300x300".

Pete

Re: imitating the -density operator

Posted: 2008-03-03T10:42:17-07:00
by mkoppanen
Thanks Pete!