Program to Wipe metadata from pictures

Friend wrote this for fun, i figured vendors could take advantage. Written in golang. Takes the image data and date and creates new image with that data.

Feel free to pm if i need to show you how to compile it. Won't be building binary's as if you accept random binary's from a random account you should not be vending

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)

}

This Code Tests picture for meta-data by reading from the img file then printing out the results

package main

import (
      "flag"
      "fmt"
      "log"
      "os"

      "github.com/rwcarlsen/goexif/exif"
      "github.com/rwcarlsen/goexif/mknote"
      )

func main() {
      var fname string
      flag.StringVar(&fname, "img", "", "Path to Image File")
      flag.Parse()
      ExampleDecode(fname)
}

//ExampleDecode decodes the image given as param 1
func ExampleDecode(fname string) {

      f, err := os.Open(fname)
      if err != nil {
                log.Fatal(err)
      }

      // Optionally register camera makenote data parsing - currently Nikon and
      // Canon are supported.
      exif.RegisterParsers(mknote.All...)

      x, err := exif.Decode(f)
      if err != nil {
                log.Fatal(err)
      }

      camModel, _ := x.Get(exif.Model) // normally, don't ignore errors!
      fmt.Println(camModel.StringVal())

      focal, _ := x.Get(exif.FocalLength)
      numer, denom, _ := focal.Rat2(0) // retrieve first (only) rat. value
      fmt.Printf("%v/%v", numer, denom)

      // Two convenience functions exist for date/time taken and GPS coords:
      tm, _ := x.DateTime()
      fmt.Println("Taken: ", tm)

      lat, long, _ := x.LatLong()
      fmt.Println("lat, long: ", lat, ", ", long)
}


Comments


[1 Points] Danknugs410:

Just post a photo to sli.mg it erases it for you