note 116416 modified in imagick.distortimage by salathe

From: Date: Fri, 02 Jan 2015 11:33:19 +0000
Subject: note 116416 modified in imagick.distortimage by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-201333@lists.php.net to get a copy of this message
It is worth nothing that details on distorts as well as arguments can be found at http://www.imagemagick.org/Usage/distorts/ - the PHP manual doesn't give much, if any, detail on arguments. I found this very useful when I had to do a translated rotation on an image - i.e. rotating around a point in the image that was not square in the center. This can be achieved by using distortImage with Imagick::DISTORTION_SCALEROTATETRANSLATE like this: <?php $imagick = new Imagick('/path/to/image'); $args = array( 20, # x point to rotate around 20, # y point to rotate around 1, # scaling factor - 1 means no scaling 90, # angle to rotate ); $imagick->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); $imagick->distortImage(Imagick::DISTORTION_SCALEROTATETRANSLATE, $args, true); ?> Note that this type of distort takes from 1 to 7 arguments, depending on what you want to do exactly - there is a lot of flexibility here. --was-- It is worth nothing that details on distorts as well as arguments can be found at http://www.imagemagick.org/Usage/distorts/ - the PHP manual doesn't give much, if any, detail on arguments. I found this very useful when I had to do a translated rotation on an image - i.e. rotating around a point in the image that was not square in the center. This can be achieved by using distortImage with Imagick::DISTORTION_SCALEROTATETRANSLATE like this: $imagick = new Imagick('/path/to/image'); $args = array( 20, # x point to rotate around 20, # y point to rotate around 1, # scaling factor - 1 means no scaling 90, # angle to rotate ); $imagick->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); $imagick->distortImage(Imagick::DISTORTION_SCALEROTATETRANSLATE, $args, true); Note that this type of distort takes from 1 to 7 arguments, depending on what you want to do exactly - there is a lot of flexibility here. http://php.net/manual/en/imagick.distortimage.php

« previous php.notes (#201333) next »