note 95532 added to function.imagick-setimageresolution

From: Date: Thu, 07 Jan 2010 14:48:36 +0000
Subject: note 95532 added to function.imagick-setimageresolution
Groups: php.notes 
Request: Send a blank email to php-notes+get-164737@lists.php.net to get a copy of this message
This method uses the "convert -density {$x_resolution}x{$y_resolution}" parameter. However be aware, that Imagick::setResolution() is much more alike the "convert -density" option than Imagick::setImageResolution() It's very irritating that both Imagick::setResolution() and Imagick::setImageResolution() are introduced with "Sets the image resolution." Use Imagick::setResolution() prior to reading a raster image. This method does not affect an image. However this method tells the image to which size it has to be sized in relation to images inherent resolution! With this method you are able to affect the real pixel-size of an image after reading. E.g. your image has a size of 100x100 pixels and an inherent resolution of 72. Setting the Resolution to 144 and reading this image results in a new image size of 200x200 pixels. <?php $im = new Imagick(); $im->setResolution(144,144); $im->readImage("test.eps"); $im->setImageFormat("png"); header("Content-Type: image/png"); echo $im; ?> Use Imagick::setImageResolution() to alter the resolution of an already read image. This method does not actually change the size of an image, but has influence to methods, which depends on a given image resolution like Imagick::resampleImage(). E.g. your image has a size of 100x100 pixels and a resolution of 72. Setting ImageResolution to 144 does nothing, unless you are resampling image afterwards in relation to the ImageResolution you set! <?php $im = new Imagick(); $im->readImage("test.eps"); $im->setImageResolution(144,144); $im->resampleImage (288,288,imagick::FILTER_UNDEFINED,1); $im->setImageFormat("png"); header("Content-Type: image/png"); echo $im; ?> which actually does the same like <?php $im = new Imagick(); $im->readImage("test.eps"); $im->setImageResolution(72,72); $im->resampleImage (144,144,imagick::FILTER_UNDEFINED,1); $im->setImageFormat("png"); header("Content-Type: image/png"); echo $im; ?> ---- Server IP: 217.160.72.57 Probable Submitter: 93.132.167.218 ---- Manual Page -- http://www.php.net/manual/en/function.imagick-setimageresolution.php Edit -- https://master.php.net/note/edit/95532 Del: integrated -- https://master.php.net/note/delete/95532/integrated Del: useless -- https://master.php.net/note/delete/95532/useless Del: bad code -- https://master.php.net/note/delete/95532/bad+code Del: spam -- https://master.php.net/note/delete/95532/spam Del: non-english -- https://master.php.net/note/delete/95532/non-english Del: in docs -- https://master.php.net/note/delete/95532/in+docs Del: other reasons-- https://master.php.net/note/delete/95532 Reject -- https://master.php.net/note/reject/95532 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164737) next »