I am using(with some tweks) the next command to create a cilinder effect in a given image (found here http://www.imagemagick.org/Usage/mappin ... cement_map):
Code: Select all
convert testImage.jpg -background white -gravity south -splice 0x10 \
\( +clone -sparse-color barycentric '0,0 black 319,0 white' \) \
\( +clone -function arcsin 1 \) \
\( -clone 1 -level 0%,100% \
-function polynomial -4,4,0 -gamma 2 \
+level 50%,0 \) \
-delete 1 -swap 0,1 miff:- |\
composite - -virtual-pixel white -displace 0x10 testImage.jpg_cylinder.jpg
Now, i am trying to create the same command in IMagick, but with no luck yet, this is what i have so far:
Code: Select all
$image = new imagick( "girl.jpg" );
$firstImage = clone $image;
$firstImage->sparseColorImage(Imagick::SPARSECOLORMETHOD_BARYCENTRIC, array( 0, 0, Imagick::COLOR_BLACK, 319, 0, Imagick::COLOR_BLACK ));
$secondImage = clone $firstImage;
$secondImage->functionImage(Imagick::DISTORTION_ARC, array(1));
$thirdImage = clone $firstImage;
$thirdImage->levelImage(0.0, 1.0, 100.0);
$thirdImage->functionImage(Imagick::FUNCTION_POLYNOMIAL, array(-4, 4, 0));
$thirdImage->gammaImage(2.0);
$thirdImage->levelImage(50.0, 1.0, 0.0);
$firstImage->compositeImage($thirdImage, Imagick::VIRTUALPIXELMETHOD_WHITE, Imagick::COMPOSITE_DISPLACE, 0,10);
$firstImage->writeImages("./out.jpg" , false);
Regards