arw

package module
v0.0.0-...-1c39505 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

package arw implements basic support for Exif 2.3 according to CIPA DC-008-2012

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptSR2

func DecryptSR2(r io.ReadSeeker, offset uint32, length uint32) []byte

func ExtractThumbnail

func ExtractThumbnail(r io.ReaderAt, offset uint32, length uint32) ([]byte, error)

ExtractThumbnail extracts an embedded JPEG thumbnail.

Types

type EXIFIFD

type EXIFIFD struct {
	Count   uint16
	FIA     []IFDFIA
	FIAvals []FIAval
	Offset  uint32
}

CIPA DC-008-2012 Chapter 4.6.2

func ExtractMetaData

func ExtractMetaData(r io.ReadSeeker, offset int64, whence int) (meta EXIFIFD, err error)

ExtractMetadata will return the first IFD from a TIFF document.

func (EXIFIFD) String

func (e EXIFIFD) String() string

type FIAval

type FIAval struct {
	IFDtype
	// contains filtered or unexported fields
}

CIPA DC-008-2012 Chapter 4.6.2

func (FIAval) String

func (f FIAval) String() string

type FaceInfo1

type FaceInfo1 struct {
	Face1Position [4]uint16

	Face2Position [4]uint16

	Face3Position [4]uint16

	Face4Position [4]uint16

	Face5Position [4]uint16

	Face6Position [4]uint16

	Face7Position [4]uint16

	Face8Position [4]uint16
	// contains filtered or unexported fields
}

type FaceInfo2

type FaceInfo2 struct {
	Face1Position [4]uint16

	Face2Position [4]uint16

	Face3Position [4]uint16

	Face4Position [4]uint16

	Face5Position [4]uint16

	Face6Position [4]uint16

	Face7Position [4]uint16

	Face8Position [4]uint16
	// contains filtered or unexported fields
}

type IFDFIA

type IFDFIA struct {
	Tag    IFDtag
	Type   IFDtype
	Count  uint32
	Offset uint32
}

IFD Field Interoperability Array CIPA DC-008-2012 Chapter 4.6.2

type IFDtag

type IFDtag uint16
const (
	NewSubFileType            IFDtag = 254
	ImageWidth                IFDtag = 256
	ImageHeight               IFDtag = 257
	BitsPerSample             IFDtag = 258
	Compression               IFDtag = 259
	PhotometricInterpretation IFDtag = 262 //32803: CFA
	ImageDescription          IFDtag = 270
	Make                      IFDtag = 271
	Model                     IFDtag = 272
	StripOffsets              IFDtag = 273
	Orientation               IFDtag = 274
	SamplesPerPixel           IFDtag = 277
	RowsPerStrip              IFDtag = 278
	StripByteCounts           IFDtag = 279
	XResolution               IFDtag = 282
	YResolution               IFDtag = 283
	PlanarConfiguration       IFDtag = 284
	ResolutionUnit            IFDtag = 296
	Software                  IFDtag = 305
	DateTime                  IFDtag = 306
	Whitepoint                IFDtag = 318
	PrimaryChromaticities     IFDtag = 319
	SubIFDs                   IFDtag = 330

	JPEGInterchangeFormat       IFDtag = 513
	JPEGInterchangeFormatLength IFDtag = 514
	YCbCrCoefficients           IFDtag = 529
	YCbCrPositioning            IFDtag = 531

	XMP IFDtag = 700 //http://www.adobe.com/products/xmp.html Some completely useless XML format

	ShotInfo         IFDtag = 0x3000
	FileFormat       IFDtag = 0xb000
	SonyModelID      IFDtag = 0xb001
	CreativeStyle    IFDtag = 0xb020
	LensSpec         IFDtag = 0xb02a
	FullImageSize    IFDtag = 0xb02b
	PreviewImageSize IFDtag = 0xb02c
	Tag9400          IFDtag = 0x9400 //Tag9400A-C

	//Following tags have been scavenged from the internet, most likely to do with the Sony raw data in ARW
	SonyRawFileType IFDtag = 0x7000
	SonyCurve       IFDtag = 0x7010

	SR2SubIFDOffset IFDtag = 0x7200
	SR2SubIFDLength IFDtag = 0x7201
	SR2SubIFDKey    IFDtag = 0x7221

	IDC_IFD  IFDtag = 0x7240
	IDC2_IFD IFDtag = 0x7241
	MRWInfo  IFDtag = 0x7250

	BlackLevel                    IFDtag = 0x7300
	WB_GRBGLevelsAuto             IFDtag = 0x7302
	WB_GRBGLevels                 IFDtag = 0x7303
	BlackLevel2                   IFDtag = 0x7310
	WB_RGGBLevels                 IFDtag = 0x7313
	WB_RGBLevelsDaylight          IFDtag = 0x7480
	WB_RGBLevelsCloudy            IFDtag = 0x7481
	WB_RGBLevelsTungsten          IFDtag = 0x7482
	WB_RGBLevelsFlash             IFDtag = 0x7483
	WB_RGBLevels4500K             IFDtag = 0x7484
	WB_RGBLevelsFluorescent       IFDtag = 0x7486
	MaxApertureAtMaxFocal         IFDtag = 0x74a0
	MaxApertureAtMinFocal         IFDtag = 0x74a1
	MaxFocalLength                IFDtag = 0x74a2
	MinFocalLength                IFDtag = 0x74a3
	SR2DataIFD                    IFDtag = 0x74c0
	ColorMatrix                   IFDtag = 0x7800
	WB_RGBLevelsDaylight2         IFDtag = 0x7820
	WB_RGBLevelsCloudy2           IFDtag = 0x7821
	WB_RGBLevelsTungsten2         IFDtag = 0x7822
	WB_RGBLevelsFlash2            IFDtag = 0x7823
	WB_RGBLevels4500K2            IFDtag = 0x7824
	WB_RGBLevelsShade2            IFDtag = 0x7825
	WB_RGBLevelsFluorescent2      IFDtag = 0x7826
	WB_RGBLevelsFluorescentP1     IFDtag = 0x7827
	WB_RGBLevelsFluorescentP2     IFDtag = 0x7828
	WB_RGBLevelsFluorescentM1     IFDtag = 0x7829
	WB_RGBLevels8500K             IFDtag = 0x782a
	WB_RGBLevels6000K             IFDtag = 0x782b
	WB_RGBLevels3200K             IFDtag = 0x782c
	WB_RGBLevels2500K             IFDtag = 0x782d
	WhiteLevel                    IFDtag = 0x787f
	VignettingCorrParams          IFDtag = 0x797d
	ChromaticAberrationCorrParams IFDtag = 0x7980
	DistortionCorrParams          IFDtag = 0x7982

	ExifTag             IFDtag = 34665
	GPSTag              IFDtag = 34853
	InteroperabilityTag IFDtag = 40965
	PrintImageMatching  IFDtag = 50341
	DefaultCropOrigin   IFDtag = 50719
	DefaultCropSize     IFDtag = 50720
	DNGPrivateData      IFDtag = 50740

	ExposureTime             IFDtag = 33434
	FNumber                  IFDtag = 33437
	ExposureProgram          IFDtag = 34850
	SpectralSensitivity      IFDtag = 34852
	ISOSpeedRatings          IFDtag = 34855
	OECF                     IFDtag = 34856
	SensitivityType          IFDtag = 34864
	RecommendedExposureIndex IFDtag = 34866
	ExifVersion              IFDtag = 36864
	DateTimeOriginal         IFDtag = 36867
	DateTimeDigitized        IFDtag = 36868
	OffsetTime               IFDtag = 36880
	OffsetTimeOriginal       IFDtag = 36881
	OffsetTimeDigitized      IFDtag = 36882
	ComponentsConfiguration  IFDtag = 37121
	CompressedBitsPerPixel   IFDtag = 37122
	ShutterSpeedValue        IFDtag = 37377
	ApertureValue            IFDtag = 37378
	BrightnessValue          IFDtag = 37379
	ExposureBiasValue        IFDtag = 37380
	MaxApertureValue         IFDtag = 37381
	SubjectDistance          IFDtag = 37382
	MeteringMode             IFDtag = 37383
	LightSource              IFDtag = 37384
	Flash                    IFDtag = 37385
	FocalLength              IFDtag = 37386
	SubjectArea              IFDtag = 37396
	MakerNote                IFDtag = 37500
	UserComment              IFDtag = 37510
	SubsecTime               IFDtag = 37520
	SubsecTimeOriginal       IFDtag = 37521
	SubsecTimeDigitized      IFDtag = 37522
	FlashpixVersion          IFDtag = 40960
	ColorSpace               IFDtag = 40961
	PixelXDimension          IFDtag = 40962
	PixelYDimension          IFDtag = 40963
	RelatedSoundFile         IFDtag = 40964
	FlashEnergy              IFDtag = 41483
	SpatialFrequencyResponse IFDtag = 41484
	FocalPlaneXResolution    IFDtag = 41486
	FocalPlaneYResolution    IFDtag = 41487
	FocalPlaneResolutionUnit IFDtag = 41488
	SubjectLocation          IFDtag = 41492
	ExposureIndex            IFDtag = 41493
	SensingMethod            IFDtag = 41495
	FileSource               IFDtag = 41728
	SceneType                IFDtag = 41729
	CFAPattern               IFDtag = 41730
	CustomRendered           IFDtag = 41985
	ExposureMode             IFDtag = 41986
	WhiteBalance             IFDtag = 41987
	DigitalZoomRatio         IFDtag = 41988
	FocalLengthIn35mmFilm    IFDtag = 41989
	SceneCaptureType         IFDtag = 41990
	GainControl              IFDtag = 41991
	Contrast                 IFDtag = 41992
	Saturation               IFDtag = 41993
	Sharpness                IFDtag = 41994
	DeviceSettingDescription IFDtag = 41995
	SubjectDistanceRange     IFDtag = 41996
	ImageUniqueID            IFDtag = 42016
	LensSpecification        IFDtag = 42034
	LensModel                IFDtag = 42036
	Gamma                    IFDtag = 42240
	CFARepeatPatternDim      IFDtag = 0x828d
	CFAPattern2              IFDtag = 0x828e
)

IFDtags mapping taken from http://www.exiv2.org/tags.html

func (IFDtag) String

func (i IFDtag) String() string

type IFDtype

type IFDtype uint16

IFD datatype, most datatypes translate in to C datatypes.

const (
	UNKNOWNTYPE IFDtype = iota
	BYTE
	ASCII
	SHORT
	LONG
	RATIONAL

	UNDEFINED
	SSHORT
	SLONG
	SRATIONAL
)

func (IFDtype) Len

func (i IFDtype) Len() int

IFDType length in bytes

func (IFDtype) String

func (i IFDtype) String() string

type RGB14

type RGB14 struct {
	Pix []pixel16
	// Stride is the Pix stride between vertically adjacent pixels.
	Stride int
	// Rect is the image's bounds.
	Rect image.Rectangle
}

RGBA64 is an in-memory image whose At method returns pixel16 values.

func NewRGB14

func NewRGB14(r image.Rectangle) *RGB14

NewRGBA returns a new RGBA image with the given bounds.

func (*RGB14) At

func (r *RGB14) At(x, y int) color.Color

func (*RGB14) Bounds

func (r *RGB14) Bounds() image.Rectangle

func (*RGB14) ColorModel

func (r *RGB14) ColorModel() color.Model

type ShotInfoTags

type ShotInfoTags struct {
	FaceInfoOffset  uint16
	SonyDateTime    [20]byte
	SonyImageHeight uint16
	SonyImageWidth  uint16
	FacesDetected   uint16
	FaceInfoLength  uint16
	MetaVersion     [16]byte

	FaceInfo1
	FaceInfo2
	// contains filtered or unexported fields
}

type TIFFHeader

type TIFFHeader struct {
	ByteOrder uint16
	FortyTwo  uint16
	Offset    uint32
}

CIPA DC-008-2012 Table 1

func ParseHeader

func ParseHeader(r io.ReadSeeker) (TIFFHeader, error)

Parses a TIFF header to determine first IFD and endianness.

Jump to

Keyboard shortcuts

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