If like me you spend a good deal of your time producing documentation with a healthy handful of images, you might use the code that follows in order to avoid Gimp/Photoshop overuse...the script generates the name, width and height of images spec'ed on the command line. If a number precedes the file spec, it is used to scale the generated information.
#!/perl/bin/perl # # imagexy.pl -- script to return width and height of image(s) use strict; use warnings; use diagnostics; use Image::Size qw(:all); my $scale; if ($ARGV[0] =~ /\d+/) { $scale = shift; } for (map {glob} @ARGV) { my ($x,$y,$id) = imgsize($_); if ($scale and $scale gt '1') { print "$_ width=",$x/$scale,"in, height=",$y/$scale,"in\n"; } else { print "$_ width=$x, height=$y\n"; } }
--hsm
"Never try to teach a pig to sing...it wastes your time and it annoys the pig."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Image Xs and Ys
by LAI (Hermit) on Jan 29, 2003 at 21:59 UTC | |
by hsmyers (Canon) on Jan 30, 2003 at 13:09 UTC | |
by LAI (Hermit) on Jan 30, 2003 at 17:43 UTC |