Sorry, this site:
https://www.socketloop.com/tutorials/golang-convert-png-transparent-background-image-to-jpg-or-jpeg-image

On Tue, Nov 8, 2016 at 3:24 PM, Jordan Stinson <jordan.stinso...@gmail.com>
wrote:

> I realize that there isn't an alpha channel. My understanding is that the
> image/draw package would blend the colours according to the alpha value in
> the image and the blending equation.
>
> This site seems to suggest that it will work.
>
> On Tue, Nov 8, 2016 at 2:37 PM, Jonathan Wills <runningw...@gmail.com>
> wrote:
>
>> jpeg does not support transparency.
>>
>> On Tue, Nov 8, 2016 at 12:14 PM, <jordan.stinso...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I'm trying to write out a png with an alpha component as a jpeg. As I
>>> understand it, I should be able to use the draw package to do this.
>>>
>>>         // src is an image.RGBA
>>>         newImg := image.NewRGBA(src.Bounds())
>>>
>>> draw.Draw(newImg, newImg.Bounds(), &image.Uniform{color.White},
>>> image.Point{}, draw.Src)
>>> draw.Draw(newImg, newImg.Bounds(), src, src.Bounds().Min, draw.Over)
>>>
>>> return jpeg.Encode(w, newImg, &jpeg.Options{Quality: 85})
>>>
>>> I expected this blend the src rgb components with the white background
>>> using the alpha value. It appears to be ignoring the alpha value all
>>> together. Is this expected? I'm using go1.7.1.
>>>
>>> Thanks!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to golang-nuts+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to