Page 1 of 1

trying to match my command line results with IMagick code

Posted: 2008-03-17T18:45:51-07:00
by flashape
So, I have this command line that does exactly what I need, works perfectly (the actual values are being set in php):

Code: Select all

$cmd2 = 'composite -compose src-over '.$headFile.' -matte -background none -rotate '.$rot.' -geometry '.$w.'x'.$h.$geomX.$geomY.'  '.$ripPath .'/frame'.$i.'.jpg '.$outputDir.'/frame'.$i.'.jpg';
When trying to accomplish this with Imagick, it's close, but as far as I can tell, the rotation works differently. Here is what I am using:

Code: Select all

$head = new Imagick( 'temp/frame' . $i . '.png' );

$frame->readImage( 'temp/frame' . $i . '.png' );
 
$tmpHead = $head->clone();
   
$tmpHead->thumbnailImage( $w, $h );
      
$tmpHead->rotateImage( 'transparent', $rot );
      
$frame->compositeImage( $tmpHead, Imagick::COMPOSITE_OVER, $x, $y );

$frame->writeImage( 'output/frame'.$i.'.jpg' );
so what's happening is that if the rotation is greater than 0, the head is being composed funny, like distorted. Any idea how to match the output of the command line?

Re: trying to match my command line results with IMagick code

Posted: 2008-03-18T04:03:12-07:00
by mkoppanen
Can I see resulting images from both the command-line operation and the imagick operation?

Re: trying to match my command line results with IMagick code

Posted: 2008-03-18T08:23:15-07:00
by flashape
Sure, here's a zip with two frames. As you can see, in the imagick one, the head is way off in size

http://www.visible-form.com/zips/imagick_test.zip

Re: trying to match my command line results with IMagick code

Posted: 2008-03-18T12:28:09-07:00
by flashape
seems like rotating the image BEFORE thumbnailing it works a lot better, except that the script runs a lot slower now.

Re: trying to match my command line results with IMagick code

Posted: 2008-03-21T13:34:35-07:00
by mkoppanen
I think the same happens with the command line version (rotate first).