I am just starting to learn PHP's Imagick library and I am needing to warp an image around a cyclinder. I have been using the following examples:
http://www.phpimagick.com/Imagick/rotateImage
To successfully rotate/scale/extent etc. the image but cannot see how I can wrap it round a cylinder.
I can see there is a way of doing so with Cylindrical Displacement
in the docs:
convert rose: -background black -gravity south -splice 0x8 \
\( +clone -sparse-color barycentric '0,0 black 69,0 white' \) \
\( +clone -function arcsin 0.5 \) \
\( -clone 1 -level 25%,75% \
-function polynomial -4,4,0 -gamma 2 \
+level 50%,0 \) \
-delete 1 -swap 0,1 miff:- |\
composite - -virtual-pixel black -displace 17x7 rose_cylinder.png
This just doesn't make much sense to me when I've been using code such as:
$img = new Imagick($the_img_path);
// to resize
$img->resizeImage($_w, $_h, imagick::FILTER_LANCZOS, 1, false);
// to crop
$img->cropImage($crop_w, $crop_h, $crop_x, $crop_y);
PHP Imagick provides mostly all functions from console util. You have just to find appropriate analogs from function list:
http://php.net/manual/en/book.imagick.php
So for
sparse
you have to use Imagick::sparseColorImage. To apply a function: Imagick::functionImage. And so on.You code will be similar to: