downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Imagick::setResourceLimit> <Imagick::setPointSize
Last updated: Fri, 30 Oct 2009

view this page in

Imagick::setResolution

(PECL imagick 2.0.0)

Imagick::setResolutionSets the image resolution

Beschreibung

bool Imagick::setResolution ( float $x_resolution , float $y_resolution )
Warnung

Diese Funktion ist bis jetzt nicht dokumentiert. Es steht nur die Liste der Argumente zur Verfügung.

Sets the image resolution.

Parameter-Liste

x_resolution

y_resolution

Rückgabewerte

Liefert TRUE bei Erfolg.



add a note add a note User Contributed Notes
Imagick::setResolution
znupi69 com
23-Aug-2008 06:55
If you want to resize a vector-graphics image (such as SVG) to a certain dimension in pixels, without losing quality, you have to do this:

<?php

$im
= new Imagick();
$im->readImage("/path/to/image.svg");
$res = $im->getImageResolution();
$x_ratio = $res['x'] / $im->getImageWidth();
$y_ratio = $res['y'] / $im->getImageHeight();
$im->removeImage();
$im->setResolution($width_in_pixels * $x_ratio, $height_in_pixels * $y_ratio);
$im->readImage("/path/to/image.svg");
// Now you can do anything with the image, such as convert to a raster image and output it to the browser:
$im->setImageFormat("png");
header("Content-Type: image/png");
echo
$im;

?>

It took me a couple or so days to figure this out, I hope this saves someone else's time! Have fun! :-)

Imagick::setResourceLimit> <Imagick::setPointSize
Last updated: Fri, 30 Oct 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites