fork of github.com/jerbob92/goheif wasm branch with module path adjusted so I can use it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forest 6e91d7c3a6 is this still needed ? 2 months ago
heic2jpg update module path so I can use it 2 months ago
heif update module path so I can use it 2 months ago
libde265 is this still needed ? 2 months ago
testdata Now registering heic decoder in stdlib during library import 6 years ago
.gitattributes fix language 6 years ago
.gitignore Webassembly implementation 2 years ago
README.md update module path so I can use it 2 months ago
go.mod update module path so I can use it 2 months ago
go.sum Webassembly implementation 2 years ago
goheif.go update module path so I can use it 2 months ago
goheif_test.go Webassembly implementation 2 years ago

README.md

GoHeif - A go gettable decoder/converter for HEIC based on libde265

Intel and ARM supported

Install

go get git.sequentialread.com/forest/goheif

  • Code Sample
func main() {
	flag.Parse()
	...
  
	fin, fout := flag.Arg(0), flag.Arg(1)
	fi, err := os.Open(fin)
	if err != nil {
		log.Fatal(err)
	}
	defer fi.Close()

	exif, err := goheif.ExtractExif(fi)
	if err != nil {
		log.Printf("Warning: no EXIF from %s: %v\n", fin, err)
	}

	img, err := goheif.Decode(fi)
	if err != nil {
		log.Fatalf("Failed to parse %s: %v\n", fin, err)
	}

	fo, err := os.OpenFile(fout, os.O_RDWR|os.O_CREATE, 0644)
	if err != nil {
		log.Fatalf("Failed to create output file %s: %v\n", fout, err)
	}
	defer fo.Close()

	w, _ := newWriterExif(fo, exif)
	err = jpeg.Encode(w, img, nil)
	if err != nil {
		log.Fatalf("Failed to encode %s: %v\n", fout, err)
	}

	log.Printf("Convert %s to %s successfully\n", fin, fout)
}

What is done

  • Changes make to @bradfitz's (https://github.com/bradfitz) golang heif parser

    • Some minor bugfixes
    • A few new box parsers, noteably 'iref' and 'hvcC'
  • Include libde265's source code (SSE by default enabled) and a simple golang binding

  • A Utility heic2jpg to illustrate the usage.

License

  • heif and libde265 are in their own licenses

  • goheif.go, libde265 golang binding and the heic2jpg utility are in MIT license

Credits

TODO

  • Upstream the changes to heif?