How do you do "-density"?

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
nextbigthing

How do you do "-density"?

Post by nextbigthing »

I'm reading in .ai and .pdf files and they look pretty bad. How can I set the -density using MagickWand?

Also,
I read in my searches about this that the default dpi is 72. Can this be changed?

Thanks in advance,
Eric James
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: How do you do "-density"?

Post by el_supremo »

The -density option sets the x and y resolution of the image. You can set the units and resolution of the image with these functions which both return a Boolean result. Call them before you read the image.
// units are PixelsPerInchResolution or PixelsPerCentimeterResolution - I don't know the PHP name for these constants (I use C).
MagickSetImageUnits(wand,PixelsPerInchResolution);
// x and y resolution are doubles.
MagickSetImageResolution(wand,300,300);

Pete
nextbigthing

Re: How do you do "-density"?

Post by nextbigthing »

Those changed did not make a difference. For now I ended up just using exec() in php so I could use -density. A bit frustrating.

Anybody have any other info on setting -density using magickwand?

Thanks again,
Eric James
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: How do you do "-density"?

Post by mkoppanen »

I guess MagickSetResolution should be used instead of MagickSetImageResolution.
Mikko Koppanen
My blog: http://valokuva.org
Post Reply