How to flip image horizontally?

All that I’ve found is:

UPD

// ...
                                // crop image
				r := image.Rect(0, 0, CropW, CropH)
				croppedImg := image.NewRGBA(r)
				draw.Draw(croppedImg, r, m, image.Point{x * CropW, y * CropH}, draw.Src)

				// flip croppedImg horizontally
				// do it using image and pixel by pixel inversing
				// croppedImg.point[x1,y1] > flippedImg.point[CropW - x1, y1]
				flippedImg := image.NewRGBA(r)
				for j := 0; j < croppedImg.Bounds().Dy(); j++ {
					for i := 0; i < croppedImg.Bounds().Dx(); i++ {
						flippedImg.Set(CropW-i, j, croppedImg.At(i, j))
					}
				}
// ...

You should try this package https://godoc.org/github.com/disintegration/imaging#Rotate
Here’s an example: https://play.golang.org/p/i2HyEe-MZBG

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.