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

search for in the

Imagick::separateImageChannel> <Imagick::sampleImage
Last updated: Fri, 10 Jul 2009

view this page in

Imagick::scaleImage

(PECL imagick 2.0.0)

Imagick::scaleImageScales the size of an image

Description

bool Imagick::scaleImage ( int $cols , int $rows [, bool $fit= false ] )
Warning

This function is currently not documented; only its argument list is available.

Scales the size of an image to the given dimensions. The other parameter will be calculated if 0 is passed as either param.

Parameters

cols

rows

fit

Return Values

Returns TRUE on success.

Errors/Exceptions

Throws ImagickException on error.

Changelog

Version Description
2.1.0 Added optional fit parameter. This method now supports proportional scaling. Pass zero as either parameter for proportional scaling.



add a note add a note User Contributed Notes
Imagick::scaleImage
benford at bluhelix dot com
16-Jun-2009 03:38
If anyone finds "The other parameter will be calculated if 0 is passed as either param. " to be a bit confusing, it means approximately this:

<?php
$im
= new Imagick('example.jpg');
$im->scaleImage(300, 0);
?>

This scales the image such that it is now 300 pixels wide, and automatically calculates the height to keep the image at the same aspect ratio.

<?php
$im
= new Imagick('example.jpg');
$im->scaleImage(0, 300);
?>

Similarly, this example scales the image to make it 300 pixels tall, and the method automatically recalculates the image's height to maintain the aspect ratio.
vincent dot hoen at gmail dot com
02-Aug-2007 01:37
Here is an easy way to resize an animated gif :

$picture = new Imagick('animated_gif.gif');

foreach($picture as $frame){
    $frame->scaleImage($width, $height);
}

Imagick::separateImageChannel> <Imagick::sampleImage
Last updated: Fri, 10 Jul 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites