From db94830bf89c910ccdaa8db1ff185a26285a80d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Tue, 9 Jan 2024 11:51:42 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20remove=20transparency=20of=20PNG=20image?= =?UTF-8?q?s=20without=20a=20.png=20extension,=20fixe=E2=80=A6=20(#9632)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: remove transparency of PNG images without a .png extension, fixes #9621 --- lib/ProductOpener/Images.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ProductOpener/Images.pm b/lib/ProductOpener/Images.pm index fab5b85e84a6a..c7e0c2819919a 100644 --- a/lib/ProductOpener/Images.pm +++ b/lib/ProductOpener/Images.pm @@ -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'));