Name
Crop( ) — crop an image
Synopsis
$image->Crop(geometry=>geometry,
width=>integer,
height=>integer,
x=>integer,
y=>integer
)
Crop( )
will extract a width by
height portion of the image starting at the offset x,y,
as shown in Figure 5.3. The
geometry
parameter is just shorthand for width and
height. To crop a 100 × 100 region starting at 20, 20,
useCrop('100x100+20+20')
. Invoking Crop( ) with the parameter 0x0
will crop off
excess “border color” from your image, where the border
color is intelligently inferred by PerlMagick. Figure 5.4 and Figure 5.3 compare
Crop( )
with Chop
( ).
Figure 5-4. $image->Crop(’30x30+90+25')
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.