Created
June 6, 2022 14:29
-
-
Save aimerneige/b55ba81abb52bf484b7f3f4bf35ee77b to your computer and use it in GitHub Desktop.
flip a image using go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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