presize - calculate resized image dimentions keeping the aspect ratio
presize [-l|--long_side |[-s|--short_side] | [-r|--ratio] | [-a|--approximate] | [-v|--verbose] | [--version | [-?|-h|--help] | [long_side_length]
This program calculates the new length of the other side of a rectanglular image when one side is given. It defaults to 4:3 aspect ratio but can be given other ratios, too.
If you give the program a side length with does not have an integer length other side, it will recursively explore and report closest integer lengths above and below the given one. E.g., using the default aspect ratio 4:3, a long side length of 5 pixels would reguire short side length 3.75 pixels which is not feasible, so two closest results are given: '8 x 6' and '4 x 3'.
Extrapolation is disabled if attribute '-approximate' is set. It is automatically disabled if special words are used to set the aspect ratio. These ratios are typically irrational numbers which make it impossible to find an exact match. Currently only words 'phi', 'golden', 'A', 'A4', 'ISO' and 'ISO216' are in use.
This program was first written to calculate side length with the correct ratio when using the crop tool in gimp (1.2 or 2.0). I found gimp's way of setting aspect ratio a bit too cumbersome to be practical.
Special words 'phi' and 'golden' can be used to set the golden ratio (1.61803398874989). To set the ratio to square root of 2 use words 'A', 'A4', 'ISO' or 'ISO216'.
0.3, 9 Feb 2004, code works
0.4, 14 Feb 2004, more and clearer docs
0.5, 21 Feb 2004, '-approximate' and some irrational numbers ratio values
If you set the ratio to something insane in relation to the side length and run perl with warnings, you will get a warning about deep recursion.
Please report other bugs to the author.
You may distribute this module under the same terms as perl itself.
Heikki Lehvaslaiho, heikki aatt ebi.ac.uk