in reply to getting the dimensions of a picture (jpeg)
#!/usr/bin/perl -w use strict; use Image::Magick; my $file="path/to/yourfile.jpg" my $image = Image::Magick->new; $image->Read($file); my ($x,$y) = $image->Get('width', 'height');
#!/usr/bin/perl -w use strict; use Image::Size; ($x, $y) = imgsize("path/to/yourfile.jpg");
sub sizeJPG { return unless $_[0]; my ($width, $height); ($height,$width) = unpack( "nn", $1 ) if $_[0] =~ /\xFF\xC0...(... +.)/; return ($width,$height); }
|
|---|