A basic DNG codec reader for Golang. It extracts and returns the JPEG thumbnail from the metadata.
package main
import (
"image"
"image/png"
"os"
_ "github.com/mdouchement/dng"
)
var (
input = "/tmp/IMG_0020.dng"
output = "/tmp/IMG_0020.png"
)
func main() {
fi, err := os.Open(input)
check(err)
defer fi.Close()
m, _, err := image.Decode(fi)
check(err)
fo, err := os.Create(output)
check(err)
png.Encode(fo, m)
}
func check(err error) {
if err != nil {
panic(err)
}
}
BSD-style
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request