Page 1 of 1

Resize with space Fill

Posted: 2010-01-20T06:51:48-07:00
by avvllvva
Hi,

Can anybody tell what is wrong with following php code for resizing image with space fill?

Code: Select all

<?php
exec($path_to_convert." ".$imagePath." -resize 80x80 -size 80x80 xc:blue +swap -gravity center  -composite ".$newPath);
?>	
This is working perfectly in local machine but not in server.

Note:- My server have Imagick S/W and its working perfectly with another methods like simple resizing, aspect ratio etc.

I tried examples from http://www.imagemagick.org/Usage/resize/#space_fill

Thanks

Re: Resize with space Fill

Posted: 2010-01-20T06:56:32-07:00
by Bonzo
See if you get an error running like this :

Code: Select all

<?php
$array=array();
echo "<pre>";
exec($path_to_convert." ".$imagePath." -resize 80x80 -size 80x80 xc:blue +swap -gravity center  -composite ".$newPath 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
?>

Re: Resize with space Fill

Posted: 2010-01-20T10:54:47-07:00
by fmw42
you could also try

convert image -resize 80x80 -gravity center -background blue -extent 80x80 result

or

convert monet3.jpg -resize "80x80^" -gravity center -crop 80x80+0+0 +repage result

if on windows see notes about ^ at http://www.imagemagick.org/Usage/windows/

Re: Resize with space Fill

Posted: 2010-01-21T03:56:33-07:00
by avvllvva
Hi Bonzo, this is the output

Array
(
[0] => convert: Unrecognized option (+swap).
)

1

------------------------------------------
also no luck with fmw42 soln

Re: Resize with space Fill

Posted: 2010-01-21T08:34:37-07:00
by Bonzo
What version is on the server compaired to your local machine ?