Skip to content

Commit

Permalink
fix: remove transparency of PNG images without a .png extension, fixe… (
Browse files Browse the repository at this point in the history
#9632)

fix: remove transparency of PNG images without a .png extension, fixes #9621
  • Loading branch information
stephanegigandet authored Jan 9, 2024
1 parent 0ff8fea commit db94830
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ProductOpener/Images.pm
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,8 @@ sub process_image_upload ($product_id, $imagefield, $user_id, $time, $comment, $
$source->AutoOrient();
$source->Strip(); #remove orientation data and all other metadata (EXIF)

# remove the transparency for PNG files
if ($extension eq "png") {
# remove the transparency when there is an alpha channel (e.g. in PNG files) by adding a white background
if ($source->Get('matte')) {
$log->debug("png file, trying to remove the alpha background") if $log->is_debug();
my $bg = Image::Magick->new;
$bg->Set(size => $source->Get('width') . "x" . $source->Get('height'));
Expand Down

0 comments on commit db94830

Please sign in to comment.