disintegration / imaging

Imaging is a simple image processing package for Go
MIT License
5.3k stars 443 forks source link

Paste should respect alpha transparency #119

Closed boosh closed 4 years ago

boosh commented 4 years ago

Hi, thanks for this library. I've got the same request as in #44. The answer given works if you're using a plain background, but I'm creating photo montages using a blown up blurred image as the background, so the solution in #44 doesn't work for me.

It'd be helpful if the paste functions respected alpha/transparency. As things stand my images are coming out with black borders if I use JPEGs, or transparent/grey pixels if I use PNGs.

It seems it's possible using image-draw...

disintegration commented 4 years ago

Hi,

The Overlay function respects the alpha channel when composing two images. E.g.:

 img := imaging.Overlay(backgroundImage, foregroundImage, image.Pt(0, 0), 1.0)

The backgroundImage can be any image, not just plain white as in #44. Could you please provide an example reproducing the issue?

boosh commented 4 years ago

Sorry, you're right. I'm not sure what I was doing earlier. Thanks!