from Imagick::compareImages(), and you want to crop the original image to the same size and position as the difference. This information is useful when the image you're trimming is the difference between two images (e.g. ImageMagick will try to preserve the aspect ratio if you use this command. Weve used the same file name here, so ImageMagick will overwrite the original file. This will leave you with two variables for the width and height of the trimmed image, plus two variables for the x-coordinate and y-coordinate of the trimmed area relative to the original image. The following command asks ImageMagick to resize an image to 200 pixels in width and 100 pixels in height: convert example.png -resize 200x100 example.png. List( $width, $height ) = array( $image -> width, $image -> height ) $image -> setImagePage ( 0, 0, 0, 0 ) So we need to reset the image page to get the right height and width of the trimmed image List( $x, $y ) = array( $imagePage, $imagePage ) * However, the width and height are of the original image * Imagick:: getImagePage() gives us an array with the width, height, x and y coordinates of the trimmed image I couldn't find an example for how to do that with this class, so here's how I did it: The command for trim can return info which tells you the coordinates of where the image was cropped and the new dimensions of the trimmed image. Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Fibers Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Predefined Attributes Context options and parameters Supported Protocols and Wrappers Security Introduction General considerations Installed as CGI binary Installed as an Apache module Session Security Filesystem Security Database Security Error Reporting User Submitted Data Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions Dealing with XForms Handling file uploads Using remote files Connection handling Persistent Database Connections Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation Authentication Services Command Line Specific Extensions Compression and Archive Extensions Cryptography Extensions Database Extensions Date and Time Related Extensions File System Related Extensions Human Language and Character Encoding Support Image Processing and Generation Mail Related Extensions Mathematical Extensions Non-Text MIME Output Process Control Extensions Other Basic Extensions Other Services Search Engine Extensions Server Specific Extensions Session Extensions Text Processing Variable and Type Related Extensions Web Services Windows Only Extensions XML Manipulation GUI Extensions Keyboard Shortcuts ? This help j Next menu item k Previous menu item g p Previous man page g n Next man page G Scroll to bottom g g Scroll to top g h Goto homepage g s Goto search
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |