Open AliFlux opened 4 years ago
Hi.
I'm trying to read some webp files and creating an alpha composite using Draw method with Over as a parameter (code below). The output shows glitchy lines where the alpha channel is merged:
This code was used:
package main import ( "fmt" "image" "image/draw" "image/png" "log" "os" "time" // swap between these two. The glitch is only in this lib //"golang.org/x/image/webp" "github.com/chai2010/webp" ) func getTile(path string) image.Image { tileStream, _ := os.Open(path) tile, _ := webp.Decode(tileStream) defer tileStream.Close() return tile } func main() { tileA := getTile("a.webp") tileB := getTile("b.webp") canvas := image.NewRGBA(image.Rect(0, 0, 500, 500)) draw.Draw(canvas, image.Rect(0, 0, tileA.Bounds().Max.X, tileA.Bounds().Max.Y), tileA, image.ZP, draw.Src) draw.Draw(canvas, image.Rect(0, 75, tileB.Bounds().Max.X, 75+tileB.Bounds().Max.Y), tileB, image.ZP, draw.Over) outputStream, _ := os.Create("result.png") png.Encode(outputStream, canvas) defer outputStream.Close() }
Using golang.org/x/image/webp fixes the issue, but it has a couple other problems therefore I can't use it.
golang.org/x/image/webp
The source files are in the following zip: experiments.zip
Hi.
I'm trying to read some webp files and creating an alpha composite using Draw method with Over as a parameter (code below). The output shows glitchy lines where the alpha channel is merged:
This code was used:
Using
golang.org/x/image/webp
fixes the issue, but it has a couple other problems therefore I can't use it.The source files are in the following zip: experiments.zip