Skip to content

Instantly share code, notes, and snippets.

@aimerneige
Created June 6, 2022 14:29
Show Gist options
  • Select an option

  • Save aimerneige/b55ba81abb52bf484b7f3f4bf35ee77b to your computer and use it in GitHub Desktop.

Select an option

Save aimerneige/b55ba81abb52bf484b7f3f4bf35ee77b to your computer and use it in GitHub Desktop.
flip a image using go
package main
import (
"image"
"log"
"os"
"github.com/disintegration/imaging"
)
func main() {
fImg, err := os.Open("./test.png")
if err != nil {
log.Fatal(err)
}
defer fImg.Close()
img, str, err := image.Decode(fImg)
if err != nil {
log.Fatal(str, err)
}
fliped := imaging.FlipV(img)
// fliped := imaging.FlipH(img)
imaging.Save(fliped, "./test-fliped.png")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment