MagestyApps / module-web-images

Magento 2 module for uploading images in optimised formats (SVG, WebP, etc.)
https://www.magestyapps.com
93 stars 16 forks source link

Unsupported watermark image format / Lighter thumbnails #22

Closed mbautista closed 5 months ago

mbautista commented 8 months ago

Hello, Thank you for this great plugin :)

The upload works well, but unfortunately product images are not generated when a (PNG) watermark is used, we have the following error : Unsupported watermark image format.

In order to solve that we added the missing callbacks to the Gd2Rewrite class :

private static $_callbacks = [ IMAGETYPE_GIF => ['output' => 'imagegif', 'create' => 'imagecreatefromgif'], // Fixes watermark IMAGETYPE_JPEG => ['output' => 'imagejpeg', 'create' => 'imagecreatefromjpeg'], // Fixes watermark IMAGETYPE_PNG => ['output' => 'imagepng', 'create' => 'imagecreatefrompng'], // Fixes watermark IMAGETYPE_XBM => ['output' => 'imagexbm', 'create' => 'imagecreatefromxbm'], // Fixes watermark IMAGETYPE_WBMP => ['output' => 'imagewbmp', 'create' => 'imagecreatefromxbm'], // Fixes watermark IMAGETYPE_WEBP => ['output' => 'imagewebp', 'create' => 'imagecreatefromwebp'], ];

It seems to work but now the thumbnail seems much more lighter than the original image, maybe it is a problem due to the watermark ?

Capture d’écran de 2023-12-13 11-10-54

Thank you for your help :)

Mathieu.

mbautista commented 8 months ago

Hello, I've tested with different images, the generated thumbnail is not just "lighter", it seems there is an color and/or alpha and/or aliasing problem, here is another example :

Capture d’écran de 2023-12-14 17-37-20

I've tried many hacks in the Gd2Rewrite::save() method, but I could not fix it :

I will try other settings and/or imagemagick and let you know if it solves my problem.

Please let me know if you have any hint :) Thank you for your help. Mathieu.

MagestyApps commented 5 months ago

We've just released version 1.1.8 where this issue is fixed. Please, upgrade to the latest version.