Hi, first I would avoid using 2D arrays for storing pixels and such, that's not even a Go thing, (although Go internal library uses a 1D array for storing pixels of images), even in C or C++ a 1D array is recomended, it is faster to say the least and more efficient.
img[x][y] becomes img[y*width+x] And you iterate exactly the same. As for Go, 2D Arrays have to be initialized properly (each array inside the main one) and 1D arrays don't have that problem. Also *png.Encode* takes a *Writer *and an *image*, so you can actually do that at once (without the buffer) as *w* (*http.ResponseWriter*) is a *Writer *already. png.Encode(w, image) -- 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.