|
Lines 74-79
sub new {
Link Here
|
| 74 |
sub _scale_image { |
74 |
sub _scale_image { |
| 75 |
my ( $self, $image, $maxwidth, $maxheight ) = @_; |
75 |
my ( $self, $image, $maxwidth, $maxheight ) = @_; |
| 76 |
my ( $width, $height ) = $image->getBounds(); |
76 |
my ( $width, $height ) = $image->getBounds(); |
|
|
77 |
$image->alphaBlending(0); |
| 78 |
$image->saveAlpha(1); |
| 77 |
if ( $width > $maxwidth || $height > $maxheight ) { |
79 |
if ( $width > $maxwidth || $height > $maxheight ) { |
| 78 |
|
80 |
|
| 79 |
my $percent_reduce; # Percent we will reduce the image dimensions by... |
81 |
my $percent_reduce; # Percent we will reduce the image dimensions by... |
|
Lines 85-95
sub _scale_image {
Link Here
|
| 85 |
} |
87 |
} |
| 86 |
my $width_reduce = sprintf( "%.0f", ( $width * $percent_reduce ) ); |
88 |
my $width_reduce = sprintf( "%.0f", ( $width * $percent_reduce ) ); |
| 87 |
my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) ); |
89 |
my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) ); |
| 88 |
my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ); #'1' creates true color image... |
90 |
my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ) |
| 89 |
$newimage->copyResampled( |
91 |
; #'1' creates true color image... |
| 90 |
$image, 0, 0, 0, 0, $width_reduce, |
92 |
$newimage->alphaBlending(0); |
| 91 |
$height_reduce, $width, $height |
93 |
$newimage->saveAlpha(1); |
| 92 |
); |
94 |
$newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, $height_reduce, $width, $height ); |
| 93 |
return $newimage; |
95 |
return $newimage; |
| 94 |
} else { |
96 |
} else { |
| 95 |
return $image; |
97 |
return $image; |