raw

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentTypes = regexp.MustCompile("^image/x-(adobe-dng|canon-cr2|canon-cr3|canon-crw|nikon-nef|nikon-nrw|sony-arw|sony-srf|sony-sr2|olympus-orf|panasonic-rw2|fuji-raf|pentax-pef|leica-rwl|sigma-x3f|samsung-srw|minolta-mrw|epson-erf|kodak-dcr|kodak-kdc|mamiya-mef|hasselblad-3fr|hasselblad-fff|phaseone-iiq|leaf-mos|casio-bay|raw)$")

Functions

This section is empty.

Types

type Meta

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

Meta is a single key/value metadata field from a RAW file. Keys follow XMP namespace conventions (tiff:Make, exif:ISOSpeedRatings, etc.).

func (*Meta) Any

func (m *Meta) Any() any

func (*Meta) Bytes

func (m *Meta) Bytes() []byte

func (*Meta) Image

func (m *Meta) Image() image.Image

func (*Meta) Key

func (m *Meta) Key() string

func (*Meta) MarshalJSON

func (m *Meta) MarshalJSON() ([]byte, error)

func (*Meta) Value

func (m *Meta) Value() string

type RAW

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

RAW wraps a libraw data handle for decoding RAW image files.

func Open

func Open(path string) (*RAW, error)

Open opens a RAW image file by path.

func Parse

func Parse(buf []byte) (*RAW, error)

Parse opens a RAW image from a byte slice.

func Read

func Read(r io.Reader) (*RAW, error)

Read opens a RAW image from a reader.

func (*RAW) Aperture

func (r *RAW) Aperture() float32

Aperture returns the f-number.

func (*RAW) Close

func (r *RAW) Close() error

Close releases the underlying libraw resources.

func (*RAW) FocalLength

func (r *RAW) FocalLength() float32

FocalLength returns the focal length in mm.

func (*RAW) Height

func (r *RAW) Height() int

Height returns the processed image height in pixels (after crop/rotation).

func (*RAW) ISOSpeed

func (r *RAW) ISOSpeed() float32

ISOSpeed returns the ISO speed rating.

func (*RAW) Image

func (r *RAW) Image() (image.Image, error)

Image demosaics and returns the full-resolution image. This is a slow operation; use Thumbnail for quick previews.

func (*RAW) Make

func (r *RAW) Make() string

Make returns the camera manufacturer.

func (*RAW) Metadata

func (r *RAW) Metadata() []media.Metadata

Metadata returns key/value pairs for camera info and shooting parameters. Keys follow XMP namespace conventions (tiff:Make, exif:ISOSpeedRatings, etc.) and implement the media.Metadata interface.

func (*RAW) Model

func (r *RAW) Model() string

Model returns the camera model.

func (*RAW) RawHeight

func (r *RAW) RawHeight() int

RawHeight returns the full sensor height before any processing.

func (*RAW) RawWidth

func (r *RAW) RawWidth() int

RawWidth returns the full sensor width before any processing.

func (*RAW) Shutter

func (r *RAW) Shutter() float32

Shutter returns the exposure time in seconds.

func (*RAW) Software

func (r *RAW) Software() string

Software returns the firmware or software string embedded in the file.

func (*RAW) Thumbnail

func (r *RAW) Thumbnail() (image.Image, error)

Thumbnail extracts and decodes the embedded preview image. This is fast since the thumbnail is pre-rendered inside the RAW file.

func (*RAW) ThumbnailBytes

func (r *RAW) ThumbnailBytes() ([]byte, error)

ThumbnailBytes returns the raw thumbnail bytes without decoding. For JPEG thumbnails (the common case) this can be passed directly to exif.Parse to extract embedded EXIF metadata.

func (*RAW) Timestamp

func (r *RAW) Timestamp() time.Time

Timestamp returns the capture time.

func (*RAW) Width

func (r *RAW) Width() int

Width returns the processed image width in pixels (after crop/rotation).

func (*RAW) XMP

func (r *RAW) XMP() []byte

XMP returns the raw XMP packet bytes embedded in the file, or nil if absent.

Jump to

Keyboard shortcuts

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