Replacing
imagecopymerge($im, $wm, $dest_x, $dest_y, 0, 0, $wm_x, $wm_y, $percentage)
with
imagecopy($im, $wm, $dest_x, $dest_y, 0, 0, $wm_x, $wm_y)
in _watermark_process() function allows to use PNG-24 watermarks with advanced transparency.

Example: http://www.ladygin.ru/files/images/IMG_4714.jpg

Comments

enky’s picture

Priority: Normal » Critical

thanks Nilard, it works, cool,

kbahey’s picture

Nilard and enky4u

Can you test that this is backward compatible with PNG- ?

if it is i will include this patch in the base module.

nilard’s picture

Yes, it's compatible to PNG-8.
Take a look at the comments for http://php.net/imagecopymerge
i found that if you use imagecopymerge with png-24 files with an alpha channel, it doesn't work use imagecopy instead.
it seems that imagecopymerge doesn't respect the alpha channel the way it should (a bug??).

kbahey’s picture

Title: imagecopymerge VS imagecopy » Use imagecopy instead of imagecopymerge to preserve PNG-24 transparency
Priority: Critical » Normal
Status: Active » Fixed

Applied to 4.7 and HEAD.

nilard’s picture

Don't forget that 'Percentage' option (for alpha blending) in admin/settings/image -> Watermark is obsolete now.

kbahey’s picture

It is already removed by that fix, since it has no meaning anymore.

Anonymous’s picture

Status: Fixed » Closed (fixed)