Skip to content

Instantly share code, notes, and snippets.

@sausheong
Created December 28, 2019 12:59
Show Gist options
  • Select an option

  • Save sausheong/6be726099a3361dd68bec27de2e26751 to your computer and use it in GitHub Desktop.

Select an option

Save sausheong/6be726099a3361dd68bec27de2e26751 to your computer and use it in GitHub Desktop.
photo mosaic blog 12
buf1 := new(bytes.Buffer)
jpeg.Encode(buf1, original, nil)
originalStr := base64.StdEncoding.EncodeToString(buf1.Bytes())
buf2 := new(bytes.Buffer)
jpeg.Encode(buf2, newimage, nil)
mosaic := base64.StdEncoding.EncodeToString(buf2.Bytes())
t1 := time.Now()
images := map[string]string{
"original": originalStr,
"mosaic": mosaic,
"duration": fmt.Sprintf("%v ", t1.Sub(t0)),
}
t, _ := template.ParseFiles("results.html")
t.Execute(w, images)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment