Skip to content

Instantly share code, notes, and snippets.

@romanitalian
Created November 8, 2020 06:45
Show Gist options
  • Save romanitalian/e65471d5c5008666a746227900799b1c to your computer and use it in GitHub Desktop.
Save romanitalian/e65471d5c5008666a746227900799b1c to your computer and use it in GitHub Desktop.
import (
"bytes"
"image"
"image/gif"
"net/http"
...
)
var buf bytes.Buffer
gif.Encode(&buf, image.Rect(0, 0, 16, 16), nil)
w.Header().Set("Content-Type", "image/jpeg")
w.Header().Set("Content-Length", strconv.Itoa(len(buf.Bytes())))
w.Write(buf.Bytes())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment