How do I create a transparent gif in Go?
1 answer
I read the image / gif source and found that there should only be a transparent color on your palette.
var palette color.Palette = color.Palette{ image.Transparent, image.Black, image.White, color.RGBA{0, 255, 0, 255}, color.RGBA{0, 100, 0, 255}, } m := image.NewPaletted(image.Rect(0, 0, pixelWidth, pixelHeight), palette) gif.Encode(w, m, &gif.Options{})
+5
source to share