imitating the -density operator

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

imitating the -density operator

Post 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 ?
Mikko Koppanen
My blog: http://valokuva.org
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: imitating the -density operator

Post by el_supremo »

Hi Mikko,

You might need

Code: Select all

MagickSetImageResolution( wand, 300, 300 );
Pete
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: imitating the -density operator

Post 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..
Mikko Koppanen
My blog: http://valokuva.org
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: imitating the -density operator

Post 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
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: imitating the -density operator

Post by mkoppanen »

Thanks Pete!
Mikko Koppanen
My blog: http://valokuva.org
Post Reply