PHP ImageMagick Plane2Cylinder Perspective

Viewed 161

I am trying to change the perspective of the Plane2Cylinder distortion in ImageMagick via PHP.

To help explain what I'm looking for, I've created this graphic:

Sample of perspective

You can see that the lower part of the red block has a greater radius than the top part, as if you were viewing this from above center.

I have tried the optional center_x/y fields:

$label->distortImage(\Imagick::DISTORTION_PLANE2CYLINDER, [28,0,100], true);

With various settings between 0 and 1000 on each x and y, with zero results.

Anyone have any insights or hints? I've search thoroughly, but can't find anything relevent.

2 Answers

I haven't fount solution with the DISTORTION_PLANE2CYLINDER but just as an idea that a hardcore perspective may reduce the strength of difference and maybe become also a point for further distortions for eg. Circular and Radial Distortion Methods (Arc).

enter image description here

plus

convert img.png \
-matte \
-virtual-pixel transparent \
-distort Perspective '200,0,0,0 100,700,100,700 700,700,700,700 600,0,800,0 ' \
img1.png

enter image description here

May give you desired radius on top and bottom.

So, after all this work trying to figure out how to do this using masks, filters, etc... the solution was actually dead simple.

I ended up just placing the main image over top of a taller transparent image (at the correct distance down from the top to create the perspective), then applying the plane2cylindar to that whole image.

So crazy I didn't see that to start. Thanks for the thoughts and help though.

Related