0

I have an image that gets rotateY(-54deg) on the front-end and I need to rotate it the same way on PHP using Imagick::distortImage

$image->distortImage(Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true);

Is there an easy way to convert the -54deg to the $controlPoints that distortImage() needs?

Ju Nogueira
  • 8,435
  • 2
  • 29
  • 33

1 Answers1

0

I dont think there is any (easy) way to do this.

The Imagick::DISTORTION_PERSPECTIVE is used to distort the images using perspective projection which requires 8 precalculated coefficients.

From the imagemagick docs

You can get these coefficients by looking at the -verbose output of a 'Perspective' distortion, or by calculating them yourself. If the last two perspective scaling coefficients are zero, the remaining 6 represents a transposed 'Affine Matrix'.

I dont think -54deg has got enough data inherently in it to decipher these 8 coefficients. You will have to do this the hard way, sorry :)

raidenace
  • 12,789
  • 1
  • 32
  • 35