@@ -, +, @@ --->Notice the background is transparent ---> Notice the background is transparent --- Koha/CoverImage.pm | 8 ++++++-- tools/upload-cover-image.pl | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) --- a/Koha/CoverImage.pm +++ a/Koha/CoverImage.pm @@ -75,6 +75,9 @@ sub new { sub _scale_image { my ( $self, $image, $maxwidth, $maxheight ) = @_; my ( $width, $height ) = $image->getBounds(); + my $background = $image->colorAllocate(0,0,0); + $image->alphaBlending(0); + $image->saveAlpha(1); if ( $width > $maxwidth || $height > $maxheight ) { my $percent_reduce; # Percent we will reduce the image dimensions by... @@ -92,8 +95,9 @@ sub _scale_image { my $height_reduce = sprintf( "%.0f", ( $height * $percent_reduce ) ); my $newimage = GD::Image->new( $width_reduce, $height_reduce, 1 ) ; #'1' creates true color image... - $newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, - $height_reduce, $width, $height ); + $newimage->alphaBlending(0); + $newimage->saveAlpha(1); + $newimage->copyResampled( $image, 0, 0, 0, 0, $width_reduce, $height_reduce, $width, $height ); return $newimage; } else { --- a/tools/upload-cover-image.pl +++ a/tools/upload-cover-image.pl @@ -102,6 +102,7 @@ if ( $op eq 'cud-process' && $fileID ) { my $upload = Koha::UploadedFiles->find( $fileID ); if ( $filetype eq 'image' ) { my $fh = $upload->file_handle; + GD::Image->trueColor(1); my $srcimage = GD::Image->new($fh); $fh->close if $fh; if ( defined $srcimage ) { @@ -190,6 +191,7 @@ if ( $op eq 'cud-process' && $fileID ) { my $full_filename = Cwd::abs_path("$dir/$filename"); #Resolve any relative filepath references my $srcimage; if ( $full_filename =~ /^\Q$dir\E/ ){ + GD::Image->trueColor(1); $srcimage = GD::Image->new($full_filename); } my $biblio; --