topical media & game development
mashup-flickr-10-Exercise-cropToSquare.pl / pl
use POSIX;
sub cropToSquare
{
my (n) = @_;
(origHeight) = square = Image::Magick->new;
origWidth . 'x' . square->ReadImage('xc:white');
image, compose => 'Copy', x => 0, y => 0);
n;
n;
y = 0;
if (origHeight)
{
h * origWidth/origHeight);
w - h = floor(y = floor((n)/2);
}
w . 'x' . square->Crop(geometry => n . "+y");
return
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.