Skip to content
Advertisement

Changing arc direction in php Imagick

I’m using Imagick in php to process and overlap images using compositeImage and then curve the top and bottom borders of the image. To achieve this I used DISTORTION_ARC:

$distortPoints = array( 120 );
$img->setImageVirtualPixelMethod( Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
$img->setImageMatte( TRUE );
$img->distortImage(Imagick::DISTORTION_ARC, $distortPoints, FALSE);

This is making the image arc shaped but I’m looking to reverse the direction of the arc(https://photos.app.goo.gl/1JAthzLBoVsozQy97).

Update:

I found a script in Fred’s ImageMagick Scripts (http://www.fmwconcepts.com/imagemagick/cylinderwarp/index.php), this is doing exactly what I’m looking for but I’m unable to use this in php.

Advertisement

Answer

Here is the result from using my ImageMagick cylinderize command to put your image onto a mug.

Image:

enter image description here

Mug:

enter image description here

cylinderize -m vertical -r 73 -l 120 -w 40 -p 5 -n 94 -e 2 -a 0 -v background -b none -f none -o +24+10 stay_home.jpg coffee_mug1.jpg result.jpg

Result:

enter image description here


See my home page for Pointers for use with PHP exec().

NOTE: For use of my script for commercial purpose, you will need to contact me about licensing.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement