Having trouble converting an image.Image to []byte. The problem spot is wrapped in dotted lines.
image_data, err := mybucket.Get(key)
if err != nil {
panic(err.Error())
}
// reset format of data []byte to image.Image
original_image, _, err := image.Decode(bytes.NewReader(image_data))
new_image := resize.Resize(160, 0, original_image, resize.Lanczos3)
- - - - - - - - - - - - - - - - - - - - - - - - - - -
// reset format the image.Image to data []byte here
var send_S3 []byte
var byteWriter = bufio.NewWriter(send_S3)
- - - - - - - - - - - - - - - - - - - - - - - - - -
err = jpeg.Encode(byteWriter, new_image, nil)
new_path := key + "_sm"
err = mybucket.Put(new_path, send_S3, "image/jpg", "aclstring")
Basically, I need new_image to be in []byte format so that I can send it up to my S3 bucket.
Thanks for the help.