I'm having trouble converting a base 64 string to gif i have tried the following.
unbased, err := base64.StdEncoding.DecodeString(bs64)
if err != nil {
panic("Cannot decode b64")
}
var imgCoupon image.Image
imgCoupon, err = gif.Decode(bytes.NewReader(unbased))
var opt gif.Options
opt.NumColors = 256
var buff bytes.Buffer
gif.Encode(&buff, imgCoupon, &opt)
but when i uploaded it in the GCP/google cloud storage the GIF doesn't animate.
this is how i upload.
sw := storageClient.Bucket(bucket).Object("test"+"_file"+".gif").NewWriter(ctx)
if _, err := io.Copy(sw, &buff); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"message": err.Error(),
"error": true,
})
return
}
the result:
how it should be:

