Name

Transform( ) — scale or crop an image

Synopsis

$image->Transform(crop=>geometry,

                     
geometry=>geometry)

Transform( ) is a convenience method that crops or scales an image to the specified dimensions with automatic sharpening. You can express the geometry parameter as a percentage string:

$image->Transform(geometry=>'50%');      # Scale proportionally to half its
                                         # size
$image->Transform(geometry=>'50%x25%');  # Scale 50% horizontally, 
                                         # 25% vertically
$image->Transform(geometry=>'160x160>'); # scale so one dimension is 
                                         # exactly 160 pixels

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.