camera

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package camera opens the RAW files of digital cameras.

A camera writes a JPEG of each photo into its RAW file, often at full size. A document gives these JPEG images as its previews (D11), and the largest one is the image that a person reviews. ivy does not decode the raw data of the sensor. A document also says the make and the model of the camera, and the date of the photo.

The package reads CR2, NEF, NRW, ARW, SRF, SR2, DNG, ORF, RW2, PEF and SRW, which are forms of TIFF, RAF of Fujifilm, and CR3 of Canon, which is a form of ISO BMFF. An ORF file keeps its large preview in the maker notes of Olympus, which the package reads too. It registers CR2, CR3, ORF, RW2 and RAF with the package image, so that image.Decode returns the largest preview. The other formats start as a plain TIFF file does, so the package does not register them, and a program opens them with Open.

Index

Constants

This section is empty.

Variables

View Source
var Format = ivy.Format{
	Name: "camera",
	Mimes: []string{
		"image/x-canon-cr2",
		"image/x-canon-cr3",
		"image/x-nikon-nef",
		"image/x-nikon-nrw",
		"image/x-sony-arw",
		"image/x-sony-srf",
		"image/x-sony-sr2",
		"image/x-adobe-dng",
		"image/x-olympus-orf",
		"image/x-panasonic-rw2",
		"image/x-pentax-pef",
		"image/x-samsung-srw",
		"image/x-fuji-raf",
	},
	Exts: []string{"cr2", "cr3", "nef", "nrw", "arw", "srf", "sr2", "dng", "orf", "rw2", "pef", "srw", "raf"},
	Open: func(ctx context.Context, src ivy.Source, cfg ivy.Config) (ivy.Document, error) {
		return Open(ctx, src, WithConfig(cfg))
	},
}

Format describes the package for the registry of a program.

Functions

func Decode

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

Decode reads a RAW file from r, and returns its largest preview. It reads at most ivy.DefaultMaxMemory bytes.

func DecodeConfig

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

DecodeConfig returns the size of the largest preview of the RAW file in r.

Types

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document is an open RAW file.

func Open

func Open(ctx context.Context, src ivy.Source, opts ...Option) (*Document, error)

Open opens a RAW file. It returns an error that wraps ivy.ErrFormat if src is not a RAW file that the package reads. A file that holds no JPEG that the package decodes opens, and lists no preview.

func (*Document) Close

func (d *Document) Close() error

Close satisfies the ivy.Document interface.

func (*Document) Describe

func (d *Document) Describe(context.Context) (ivy.Info, error)

Describe satisfies the ivy.Describer interface. Producer is the make and the model of the camera, and Created is the date of the photo.

func (*Document) Previews

func (d *Document) Previews(context.Context) iter.Seq2[ivy.Preview, error]

Previews satisfies the ivy.Previewer interface. It lists the JPEG images of the file, largest first.

type Option

type Option func(*options)

Option is an option of Open.

func WithConfig

func WithConfig(cfg ivy.Config) Option

WithConfig sets the configuration that every format shares.

Jump to

Keyboard shortcuts

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