NAME

Math::RatioResize - Work out new dimensions for an image (or just a rectangle) when restricted in one dimension.

VERSION

Version 0.03

SYNOPSIS

Given a box dimensions (width and height), and a max width or height, return back the resized dimensions whilst maintaining the aspect-ratio.

use Math::RatioResize;

my ( $w, $h ) = Math::RatioResize->resize( w => 360, h => 240, max_w => 100 );

$w == 100
$h == 66.66   # 240 * ( 100 / 360 )

METHODS

Class Methods

resize

As above.

AUTHOR

Rob Brown, <rob at intelcompute.com>

BUGS

Please report any bugs or feature requests to bug-image-empty at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math-RatioResize. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Math::RatioResize

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2013 Rob Brown.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.