dng

package module
v0.0.0-...-4066c91 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2023 License: BSD-3-Clause Imports: 6 Imported by: 1

README

DNG - Digital Negative

A basic DNG codec reader for Golang. It extracts and returns the JPEG thumbnail from the metadata.

Usage

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)
	}
}

License

BSD-style

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader) (image.Image, error)

Decode reads a DNG image from r and returns the embedded JPEG thumbnail as an image.Image.

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

DecodeConfig returns the color model and dimensions of a TIFF image without decoding the entire image.

func NewReader

func NewReader(r io.Reader) (io.Reader, error)

NewReader returns an io.Reader to the JPEG thumbnail embedded in the DNG image in r. This allows access to the raw bytes of the JPEG thumbnail without the need to decompress it first.

Types

type FormatError

type FormatError string

A FormatError reports that the input is not a valid TIFF image.

func (FormatError) Error

func (e FormatError) Error() string

type InternalError

type InternalError string

An InternalError reports that an internal error was encountered.

func (InternalError) Error

func (e InternalError) Error() string

type UnsupportedError

type UnsupportedError string

An UnsupportedError reports that the input uses a valid but unimplemented feature.

func (UnsupportedError) Error

func (e UnsupportedError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL