Image manipulation using serverless Go functions
func invert(img image.Image) *image.RGBA {
bounds := img.Bounds()
imgSet := image.NewRGBA(bounds)
for y := 0; y < bounds.Max.Y; y++ {
for x := 0; x < bounds.Max.X; x++ {
r, g, b, a := img.At(x, y).RGBA()
col := color.RGBA{
255 - uint8(r/256), 255 - uint8(g/256),
255 - uint8(b/256), uint8(a / 256),
}
imgSet.Set(x, y, col)
}
}
return imgSet
}