in reply to Re: Re: Image Xs and Ys
in thread Image Xs and Ys
Whoops, I didn't even notice that.
Wait... why the hell are you using inches anyway? If you're scaling the image by a factor of 3, let's say, and the image is 120*50 pixels, it'll still be 360*150 pixels. Unless $scale is dpi?
Which, come to think of it, makes a lot of sense. Oh, I guess that's what you meant in the first place. Never mind me, I'm running low on lifeblood caffeine. But let's say the scale is specified as 1 dot per inch. (big crappy billboards or whatever) Then the measurement should be in inches.
If this is the case, then the unit of measurement is inches if a dpi is specified, pixels otherwise, and the code is:
# 'use's and stuff go here my ($scale, $unit) = ($ARGV[0] =~ /^\d+$/) ? (shift,"in") : (1,"px"); for (map {glob} @ARGV) { my ($x,$y,$id) = imgsize($_); print "$_ width=",$x/$scale,"$unit, height=",$y/$scale,"$unit\n"; }
Update: just a bit of tidying
|
|---|