#!/usr/bin/perl # # Rewritten for GIMP 1.2 and the Graphics Muse Tools CD # by Michael J. Hammel (mjhammel@graphics-muse.org # Jan 26, 2002 use Gimp qw( :auto ); use Gimp::Fu; sub load_scale { my ($loadname, $width, $height) = @_; my ($new_width, $new_height) = ($width, $height); my $img = file_jpeg_load($loadname, $loadname); my ($img_width, $img_height) = (gimp_image_width($img), gimp_image_height($img)); if ($img_width > $img_height) { ($new_width, $new_height) = ($width, $width * $img_height / $img_width); } else { ($new_width, $new_height) = ($width * $img_width / $img_height, $height); } gimp_image_scale($img, $new_width, $new_height); return $img; } register "load_scale_jpeg", "Load and scale a JPEG image", "Loads the specified JPEG image and scales it appropriately.", "Rick Haines", "Copyright (C) 1999 Rick Haines", "17 April 1999", "/Xtns/Perl-Fu/Load and Scale JPEGs", "*", [ [PF_STRING, "loadname", "file to load", "load.jpg"], [PF_INT32, "width", "requested width", 1024], [PF_INT32, "height", "requested height", 768], ], \&load_scale; exit main;