[PHP] Imagick morphImages

2013-03-11 Thread Leonard Burton
HI,

*Imagick::morphImages* ( int $number_frames )

http://php.net/manual/en/imagick.morphimages.php


Would someone please reply with how to add the two images for this?

None of the search results come back with anything other than the
auto-generated info on the imagick class.

Many Thanks!



-- 
Leonard Burton, N9URK
leonardbur...@gmail.com

The prolonged evacuation would have dramatically affected the
survivability of the occupants.


FW: [PHP] Imagick morphImages

2013-03-11 Thread Jen Rasmussen
I found the following code here: https://gist.github.com/mywebpower/1035026
It appears 2 years old though ...

?php
/**
 * GD+Imagick = morphing
 * 
 * @param string  $fromPath
 * @param string  $toPath
 * @param string  $outPath
 * @param integer $frame OPTIONAL
 * @param integer $delay OPTIONAL
 */
function morph($fromPath, $toPath, $outPath, $frame=10, $delay=1) {
  $im = new Imagick();

  $gf = imagecreatefromjpeg($fromPath);  
  $gt = imagecreatefromjpeg($toPath);
  $sz = getimagesize($toPath);
  
  $wkImg = '__work__.jpg';
  
  for($i=1; $i=$frame; $i++) {

imagecopymerge($gf, $gt, 0,0, 0,0, $sz[0],$sz[1], (100/$frame)*$i);
imagejpeg($gf, $wkImg);

$tmp = new Imagick($wkImg);
$tmp-setFormat('gif');
$tmp-setImageDelay($delay*100);
$im-addImage($tmp);

$tmp-destroy();
unlink($wkImg);
  }
  
  $im-writeImages($outPath, true);
  $im-destroy();
  imagedestroy($gf);
  imagedestroy($gt);
}

// ex
morph('a.jpg', 'b.jpg', 'out.gif', 10, 0.1);
?

Hope it helps,
Jen


-Original Message-
From: Leonard Burton [mailto:leonardbur...@gmail.com] 
Sent: Monday, March 11, 2013 1:26 PM
To: php-general@lists.php.net
Subject: [PHP] Imagick morphImages

HI,

*Imagick::morphImages* ( int $number_frames )

http://php.net/manual/en/imagick.morphimages.php


Would someone please reply with how to add the two images for this?

None of the search results come back with anything other than the
auto-generated info on the imagick class.

Many Thanks!



--
Leonard Burton, N9URK
leonardbur...@gmail.com

The prolonged evacuation would have dramatically affected the survivability
of the occupants.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php