How do I create a transparent gif in Go? -


when encode gif in go, background black. how make background transparent?

here code in http handler. (w responsewriter)

m := image.newrgba(image.rect(0, 0, pixelwidth, pixelheight)) gif.encode(w, m, &gif.options{numcolors: 16})  

i read source of image/gif , found there has transparent color on 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{})  

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -