[TYPO3-english] cropping with imagemagick

Martin <Denmark> martin.aarhof at gmail.com
Mon Nov 8 14:23:03 CET 2010


Hi,

Im trying to crop a image with imagemagick

$params = ' -crop ' . $w . 'x' . $h . '+' . $x . '+' . $y;
$imagick = t3lib_div::makeInstance("t3lib_stdGraphic");
$imagick->init();
$imagick->tempPath = $this->typo3temp_path;
$imagick->dontCheckForExistingTempFile=1;
$imagick->filenamePrefix="temp_cropimage_";
$imagick->dontCompress=1;
$imagick->IM_commands = array();
		
$convert = $imagick->imageMagickConvert($this->file, '', '', '', 
$params, '', '', 1);
$return = t3lib_div::upload_copy_move($convert[3], $outputdir . 
$newfilename);

It works flawless BUT the image im trying to crop has the same width and 
height as original but the thing I cropped is on the same place with a 
white background.

var_dump($imagick->IM_commands) gives

Array
(
     [0] => Array
         (
             [0] => /.../typo3temp/pics/temp_cropimage_e9a8af6b17.gif
             [1] => /usr/bin/convert +profile '*' -geometry 417x106! 
-crop 31x35+134+17  '/.../fileadmin/user_upload/banner.gif'[0] 
'/.../typo3temp/pics/temp_cropimage_e9a8af6b17.gif'
         )

)

And a var_dump($params) gives
-crop 31x35+134+17


I suspect that -geometry to be the problem, but how do I remove that?


More information about the TYPO3-english mailing list