Go has great image manipulation and data libraries however I'm having trouble creating one big image from smaller ones. Does anyone know how to take two png or jpeg files in Golang and concatenate them to form one big image that encompasses the two (or more) files?
i'm currently reading png files like so:
imgFile, err := os.Open(path)
if err != nil {
return Image{}, err
}
img, _, err := image.Decode(imgFile)
if err != nil {
return Image{}, err
}
rgba := image.NewRGBA(img.Bounds())
if rgba.Stride != rgba.Rect.Size().X*4 {
return Image{}, fmt.Errorf("unsupported stride")
}
draw.Draw(rgba, rgba.Bounds(), img, image.Point{0, 0}, draw.Src)
I'm confused on how to take this png RGBA data and concatenate with other RGBA data and/or combine that into an "empty" image.