Created
September 28, 2016 02:13
-
-
Save justyntemme/b9cfefc07cf7bc80c6d73b03cf1ce877 to your computer and use it in GitHub Desktop.
This file contains 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 ( | |
"flag" | |
"image/jpeg" | |
"log" | |
"os" | |
) | |
func main() { | |
var fname string | |
flag.StringVar(&fname, "img", "", "Path to Image File") | |
flag.Parse() | |
imagef, err := os.Open(fname) | |
if err != nil { | |
log.Fatal(err) | |
} | |
img, err := jpeg.Decode(imagef) | |
if err != nil { | |
log.Fatal(err) | |
} | |
out, err := os.Create("./output.jpg") | |
if err != nil { | |
log.Fatal(err) | |
} | |
jpeg.Encode(out, img, nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment