Skip to content

Instantly share code, notes, and snippets.

@artyom
Created November 25, 2013 12:41
Show Gist options
  • Save artyom/7640686 to your computer and use it in GitHub Desktop.
Save artyom/7640686 to your computer and use it in GitHub Desktop.
Remove EXIF data from image by resaving it.
package main
import (
"image"
"image/jpeg"
"log"
"os"
)
func main() {
file, err := os.Open("input.jpg")
if err != nil {
log.Fatal(err)
}
defer file.Close()
img, _, err := image.Decode(file)
if err != nil {
log.Fatal(err)
}
outfile, err := os.Create("output.jpg")
if err != nil {
log.Fatal(err)
}
defer outfile.Close()
if err := jpeg.Encode(outfile, img, nil); err != nil {
log.Fatal(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment