Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeIptc(r io.Reader) (map[IptcRecordTag]IptcRecordDataset, error)
- func EncodeIptc(w io.Writer, recs map[IptcRecordTag]IptcRecordDataset) error
- func ExifTagName(index ExifIndex, tag ExifTag) string
- func ExifValueIsAllowed(index ExifIndex, tag ExifTag, value interface{}) bool
- func ExifValueString(index ExifIndex, tag ExifTag, value interface{}) string
- func ExifValueStringErr(index ExifIndex, tag ExifTag, value interface{}) (string, error)
- func IptcTagName(record IptcRecord, tag IptcTag) string
- func ParseIptcJpeg(sl *jpegstructure.SegmentList) (map[IptcRecordTag]IptcRecordDataset, error)
- type ExifData
- func (ed *ExifData) GetImageDescription() string
- func (ed *ExifData) GetUserComment() string
- func (ed *ExifData) GpsInfo() (*exif.GpsInfo, error)
- func (ed *ExifData) HasIfd(index ExifIndex) bool
- func (ed *ExifData) Ifd(index ExifIndex) *exif.Ifd
- func (ed *ExifData) IsEmpty() bool
- func (ed *ExifData) Scan(ifdIndex ExifIndex, tagId ExifTag, dest interface{}) error
- func (ed *ExifData) ScanExifDate(dateTag ExifDate, dest *time.Time) error
- func (ed *ExifData) ScanIfdExif(tag ExifTag, dest interface{}) error
- func (ed *ExifData) ScanIfdIop(tagId ExifTag, dest interface{}) error
- func (ed *ExifData) ScanIfdRoot(tagId ExifTag, dest interface{}) error
- func (ed *ExifData) ScanIfdThumbnail(tagId ExifTag, dest interface{}) error
- func (ed *ExifData) String() string
- type ExifDate
- type ExifEditor
- func (ee *ExifEditor) Clear(dirty bool) error
- func (ee *ExifEditor) IfdBuilder() (*exif.IfdBuilder, bool)
- func (ee ExifEditor) IsDirty() bool
- func (ee ExifEditor) IsEmpty() bool
- func (ee *ExifEditor) SetDate(dateTag ExifDate, time time.Time) error
- func (ee *ExifEditor) SetDirty()
- func (ee *ExifEditor) SetIfdExifTag(id ExifTag, value interface{}) error
- func (ee *ExifEditor) SetIfdRootTag(id ExifTag, value interface{}) error
- func (ee *ExifEditor) SetImageDescription(description string) error
- func (ee *ExifEditor) SetUserComment(comment string) error
- type ExifIndex
- type ExifIndexTag
- type ExifTag
- type ExifTagDesc
- type ExifTagType
- type IptcData
- func (ipd *IptcData) GetDate(dateTag IptcDate) time.Time
- func (ipd *IptcData) GetKeywords() []string
- func (ipd *IptcData) GetTitle() string
- func (ipd *IptcData) IsEmpty() bool
- func (ipd *IptcData) RawIptc() map[IptcRecordTag]IptcRecordDataset
- func (ipd *IptcData) Scan(record IptcRecord, tag IptcTag, dest interface{}) error
- func (ipd *IptcData) ScanApplication(tag IptcTag, dest interface{}) error
- func (ipd *IptcData) ScanDate(dateTag IptcDate, dest *time.Time) error
- func (ipd *IptcData) ScanEnvelope(tag IptcTag, dest interface{}) error
- func (ipd *IptcData) String() string
- type IptcDate
- type IptcEditor
- func (ie *IptcEditor) Bytes() ([]byte, error)
- func (ie *IptcEditor) Clear(dirty bool)
- func (ie IptcEditor) IsDirty() bool
- func (ie IptcEditor) IsEmpty() bool
- func (ie *IptcEditor) Set(record IptcRecord, tag IptcTag, value interface{}) error
- func (ie *IptcEditor) SetDate(dateTag IptcDate, t time.Time) error
- func (ie *IptcEditor) SetDirty()
- func (ie *IptcEditor) SetEnvelope(tag IptcTag, value interface{}) error
- func (ie *IptcEditor) SetKeywords(keywords []string) error
- func (ie *IptcEditor) SetTitle(title string) error
- type IptcRecord
- type IptcRecordDataset
- type IptcRecordTag
- type IptcTag
- type IptcTagDesc
- type IptcTagType
- type JpegEditor
- func (je *JpegEditor) Bytes() ([]byte, error)
- func (je *JpegEditor) CopyMetaData(sourceImg []byte) error
- func (je *JpegEditor) DropExif() error
- func (je *JpegEditor) DropIptc() error
- func (je *JpegEditor) DropMetaData() error
- func (je *JpegEditor) DropXmp() error
- func (je JpegEditor) Exif() *ExifEditor
- func (je JpegEditor) Iptc() *IptcEditor
- func (je *JpegEditor) MetaData() (*MetaData, error)
- func (je *JpegEditor) SetKeywords(keywords []string) error
- func (je *JpegEditor) SetTitle(title string) error
- func (je *JpegEditor) WriteFile(dest string) error
- func (je JpegEditor) Xmp() *XmpEditor
- type LensInfo
- type MetaData
- type Rat
- type Summary
- type URat
- type XmpData
- func (xd XmpData) Base() *xmpbase.XmpBase
- func (xd XmpData) DublinCore() *dc.DublinCore
- func (xd XmpData) GetKeywords() []string
- func (xd XmpData) GetRating() uint16
- func (xd XmpData) GetTitle() string
- func (xd XmpData) IsEmpty() bool
- func (xd XmpData) MM() *xmpmm.XmpMM
- func (xd XmpData) PhotoShop() *ps.PhotoshopInfo
- func (xd XmpData) String() string
- type XmpEditor
- func (xe *XmpEditor) Bytes(prefix bool) ([]byte, error)
- func (xe *XmpEditor) Clear(dirty bool)
- func (xe *XmpEditor) Document() *xmp.Document
- func (xe XmpEditor) IsDirty() bool
- func (xe *XmpEditor) SetDirty()
- func (xe *XmpEditor) SetDocument(doc *xmp.Document, dirty bool)
- func (xe *XmpEditor) SetKeywords(keywords []string)
- func (xe *XmpEditor) SetRating(rating uint16)
- func (xe *XmpEditor) SetTitle(title string)
Examples ¶
Constants ¶
const ( ExifDateTime = "2006:01:02 15:04:05" ExifDateTimeOffset = "2006:01:02 15:04:05 -07:00" )
Exif Time formats
const ( IptcShortDate = "20060102" IptcLongDateOffset = "20060102150405-0700" IptcLongDate = "20060102150405" IptcTime = "150405-0700" )
Iptc date & time format
Variables ¶
var ( ErrExifNoData = errors.New("No Exif data") ErrExifTagNotFound = errors.New("Ifd tag not found") ErrExifValueNotFound = errors.New("Ifd value not found") ErrExifParseTag = errors.New("Exif tag could not be parsed") ErrExifUndefinedType = errors.New("Tag type undefined") )
Exif errors
var ( ErrNoIptc = errors.New("No IPTC data") ErrIptcTagNotFound = errors.New("Iptc tag not found") ErrIptcTagValue = errors.New("Iptc tag value not corret") ErrIptcUndefinedType = errors.New("Could not parse ") )
Iptc related errors
var ErrNoXmp = errors.New("No XMP data")
ErrNoXmp when a jpeg image does not contain any xmp data
var ErrParseImage = errors.New("Could not parse image")
ErrParseImage if a file or byte slice could not be parsed as a jpeg image
var ExifTagDescriptions = map[ExifIndexTag]ExifTagDesc{}/* 419 elements not displayed */
Exif Tag Descriptions
var IFDPaths = map[ExifIndex]string{ RootIFD: "IFD", ExifIFD: "IFD/Exif", GpsIFD: "IFD/GPSInfo", InteropIFD: "IFD/Exif/Iop", ThumbnailIFD: "IFD1", }
var IptcRecordName = map[IptcRecord]string{ IPTCPostObjectData: "IPTCPostObjectData", IPTCPreObjectData: "IPTCPreObjectData", IPTCApplication: "IPTCApplication", IPTCEnvelope: "IPTCEnvelope", IPTCFotoStation: "IPTCFotoStation", IPTCNewsPhoto: "IPTCNewsPhoto", IPTCObjectData: "IPTCObjectData", }
var IptcTagDescriptions = map[IptcRecordTag]IptcTagDesc{}/* 116 elements not displayed */
IPTC Tag Descriptions
Functions ¶
func DecodeIptc ¶
func DecodeIptc(r io.Reader) (map[IptcRecordTag]IptcRecordDataset, error)
DecodeIptc according to https://iptc.org/std/IIM/4.2/specification/IIMV4.2.pdf
func EncodeIptc ¶
func EncodeIptc(w io.Writer, recs map[IptcRecordTag]IptcRecordDataset) error
EncodeIptc according to https://iptc.org/std/IIM/4.2/specification/IIMV4.2.pdf
func ExifTagName ¶
ExifTagName returns the common name of specific ExifTag
func ExifValueIsAllowed ¶
ExifValueIsAllowed checks if an ExifTag value is ok to use. Most tags dont have any specific values defined. see (https://exiftool.org/TagNames/EXIF.html)
func ExifValueString ¶
ExifValueString returns the common name of specific ExifTag value. E.g. "No Flash" for value 0 for the FlashTag. If no mapping is found returns "undefined"
func ExifValueStringErr ¶
ExifValueStringErr returns the common name of the ExifTag value or an error, either ErrExifValueNotFound or ErrExifUndefinedType
func IptcTagName ¶
func IptcTagName(record IptcRecord, tag IptcTag) string
IptcTagName returns the common name for a tag in record
func ParseIptcJpeg ¶
func ParseIptcJpeg(sl *jpegstructure.SegmentList) (map[IptcRecordTag]IptcRecordDataset, error)
ParseIptcJpeg extracts iptc data from a jpeg segment list. Returns ErrNoIptc if the segments dont contain any IPTC data
Types ¶
type ExifData ¶
type ExifData struct {
// contains filtered or unexported fields
}
ExifData holds the underlying IfdIndex
func NewExifData ¶
func NewExifData(segments *jpegstructure.SegmentList) (*ExifData, error)
NewExifData creates an ExifData from a jpeg segment list. Returns ErrExifNoData if the segment list did not contain any exif data
func (*ExifData) GetImageDescription ¶ added in v0.0.10
GetImageDescription returns IFD_ImaageDescription or "" if the tag was not set
func (*ExifData) GetUserComment ¶ added in v0.0.10
GetUserComment returns ExifIFD_UserComment as a string or "" if there was an error getting the comment. The comment is assumed to be encoded using exifundefined.Tag9286UserComment
func (*ExifData) ScanExifDate ¶
ScanExifDate reads the given dateTag into dest
func (*ExifData) ScanIfdExif ¶
ScanIfdExif scans tag from ExifIFD into dest
func (*ExifData) ScanIfdIop ¶
ScanIfdIop scans tag from InteropIFD into dest
func (*ExifData) ScanIfdRoot ¶
ScanIfdRoot scans tag from RootIFD into dest
Example ¶
md, err := NewMetaDataFromFile("../assets/leica.jpg") if err != nil { fmt.Printf("Could not open file: %v\n", err) return } cameraMake := "" err = md.Exif().ScanIfdRoot(IFD_Make, &cameraMake) if err != nil { fmt.Printf("Could not scan ifd tag: %v\n", err) return } fmt.Printf("Make: %s\n", cameraMake)
Output: Make: LEICA CAMERA AG
func (*ExifData) ScanIfdThumbnail ¶
ScanIfdThumbnail scans tag from ThumbnailIFD into dest
type ExifEditor ¶
type ExifEditor struct {
// contains filtered or unexported fields
}
ExifEditor holds an IfdBuilder
func NewExifEditor ¶
func NewExifEditor(sl *jpegstructure.SegmentList) (*ExifEditor, error)
NewExifEditor from a jpeg segment list
func NewExifEditorEmpty ¶
func NewExifEditorEmpty(dirty bool) (*ExifEditor, error)
NewExifEditorEmpty create a new empty editor and sets the dirty flag
func (*ExifEditor) Clear ¶
func (ee *ExifEditor) Clear(dirty bool) error
Clear this editor and sets the dirty flag
func (*ExifEditor) IfdBuilder ¶
func (ee *ExifEditor) IfdBuilder() (*exif.IfdBuilder, bool)
IfdBuilder returns the underlying IfdBuilder. If it was changed it will also set the IFD Software tag.
func (ExifEditor) IsDirty ¶
func (ee ExifEditor) IsDirty() bool
IsDirty if this editor has made any edits
func (ExifEditor) IsEmpty ¶
func (ee ExifEditor) IsEmpty() bool
IsEmpty returns true if the IfdBuilder contains no data
func (*ExifEditor) SetDate ¶
func (ee *ExifEditor) SetDate(dateTag ExifDate, time time.Time) error
SetDate sets the specified dateTag to time. Both the DateTime and corresponding offest will be set
func (*ExifEditor) SetDirty ¶
func (ee *ExifEditor) SetDirty()
SetDirty force this editor to be marked as dirty
func (*ExifEditor) SetIfdExifTag ¶
func (ee *ExifEditor) SetIfdExifTag(id ExifTag, value interface{}) error
SetIfdExifTag sets the ExifIFD tag id to value
func (*ExifEditor) SetIfdRootTag ¶
func (ee *ExifEditor) SetIfdRootTag(id ExifTag, value interface{}) error
SetIfdRootTag set RootIFD tag id to value
func (*ExifEditor) SetImageDescription ¶
func (ee *ExifEditor) SetImageDescription(description string) error
SetImageDescription sets IFD_ImageDescription to description
func (*ExifEditor) SetUserComment ¶
func (ee *ExifEditor) SetUserComment(comment string) error
SetUserComment sets ExifIFD_UserComment to comment using exifundefined.Tag9286UserComment. The comment will be Unicode encoded
type ExifIndexTag ¶
type ExifTag ¶
type ExifTag uint16
const ( IFD_ProcessingSoftware ExifTag = 0x000b IFD_SubfileType ExifTag = 0x00fe IFD_OldSubfileType ExifTag = 0x00ff IFD_ImageWidth ExifTag = 0x0100 IFD_ImageHeight ExifTag = 0x0101 IFD_BitsPerSample ExifTag = 0x0102 IFD_Compression ExifTag = 0x0103 IFD_PhotometricInterpretation ExifTag = 0x0106 IFD_Thresholding ExifTag = 0x0107 IFD_CellWidth ExifTag = 0x0108 IFD_CellLength ExifTag = 0x0109 IFD_FillOrder ExifTag = 0x010a IFD_DocumentName ExifTag = 0x010d IFD_ImageDescription ExifTag = 0x010e IFD_Make ExifTag = 0x010f IFD_Model ExifTag = 0x0110 IFD_StripOffsets ExifTag = 0x0111 IFD_Orientation ExifTag = 0x0112 IFD_SamplesPerPixel ExifTag = 0x0115 IFD_RowsPerStrip ExifTag = 0x0116 IFD_StripByteCounts ExifTag = 0x0117 IFD_MinSampleValue ExifTag = 0x0118 IFD_MaxSampleValue ExifTag = 0x0119 IFD_XResolution ExifTag = 0x011a IFD_YResolution ExifTag = 0x011b IFD_PlanarConfiguration ExifTag = 0x011c IFD_PageName ExifTag = 0x011d IFD_XPosition ExifTag = 0x011e IFD_YPosition ExifTag = 0x011f IFD_GrayResponseUnit ExifTag = 0x0122 IFD_ResolutionUnit ExifTag = 0x0128 IFD_PageNumber ExifTag = 0x0129 IFD_TransferFunction ExifTag = 0x012d IFD_Software ExifTag = 0x0131 IFD_ModifyDate ExifTag = 0x0132 IFD_Artist ExifTag = 0x013b IFD_HostComputer ExifTag = 0x013c IFD_Predictor ExifTag = 0x013d IFD_WhitePoint ExifTag = 0x013e IFD_PrimaryChromaticities ExifTag = 0x013f IFD_HalftoneHints ExifTag = 0x0141 IFD_TileWidth ExifTag = 0x0142 IFD_TileLength ExifTag = 0x0143 IFD_SubIFDs ExifTag = 0x014a IFD_InkSet ExifTag = 0x014c IFD_TargetPrinter ExifTag = 0x0151 IFD_SampleFormat ExifTag = 0x0153 IFD_ThumbnailOffset ExifTag = 0x0201 IFD_ThumbnailLength ExifTag = 0x0202 IFD_YCbCrCoefficients ExifTag = 0x0211 IFD_YCbCrSubSampling ExifTag = 0x0212 IFD_YCbCrPositioning ExifTag = 0x0213 IFD_ReferenceBlackWhite ExifTag = 0x0214 IFD_ApplicationNotes ExifTag = 0x02bc IFD_Rating ExifTag = 0x4746 IFD_RatingPercent ExifTag = 0x4749 IFD_VignettingCorrection ExifTag = 0x7031 IFD_VignettingCorrParams ExifTag = 0x7032 IFD_ChromaticAberrationCorrection ExifTag = 0x7034 IFD_ChromaticAberrationCorrParams ExifTag = 0x7035 IFD_DistortionCorrection ExifTag = 0x7036 IFD_DistortionCorrParams ExifTag = 0x7037 IFD_SonyCropTopLeft ExifTag = 0x74c7 IFD_SonyCropSize ExifTag = 0x74c8 IFD_CFARepeatPatternDim ExifTag = 0x828d IFD_CFAPattern2 ExifTag = 0x828e IFD_Copyright ExifTag = 0x8298 IFD_PixelScale ExifTag = 0x830e IFD_IPTCNAA ExifTag = 0x83bb IFD_IntergraphMatrix ExifTag = 0x8480 IFD_ModelTiePoint ExifTag = 0x8482 IFD_SEMInfo ExifTag = 0x8546 IFD_ModelTransform ExifTag = 0x85d8 IFD_PhotoshopSettings ExifTag = 0x8649 IFD_ExifOffset ExifTag = 0x8769 IFD_ICC_Profile ExifTag = 0x8773 IFD_GeoTiffDirectory ExifTag = 0x87af IFD_GeoTiffDoubleParams ExifTag = 0x87b0 IFD_GeoTiffAsciiParams ExifTag = 0x87b1 IFD_GPSInfo ExifTag = 0x8825 IFD_ImageSourceData ExifTag = 0x935c IFD_XPTitle ExifTag = 0x9c9b IFD_XPComment ExifTag = 0x9c9c IFD_XPAuthor ExifTag = 0x9c9d IFD_XPKeywords ExifTag = 0x9c9e IFD_XPSubject ExifTag = 0x9c9f IFD_GDALMetadata ExifTag = 0xa480 IFD_GDALNoData ExifTag = 0xa481 IFD_PrintIM ExifTag = 0xc4a5 IFD_DNGVersion ExifTag = 0xc612 IFD_DNGBackwardVersion ExifTag = 0xc613 IFD_UniqueCameraModel ExifTag = 0xc614 IFD_LocalizedCameraModel ExifTag = 0xc615 IFD_CFAPlaneColor ExifTag = 0xc616 IFD_CFALayout ExifTag = 0xc617 IFD_LinearizationTable ExifTag = 0xc618 IFD_BlackLevelRepeatDim ExifTag = 0xc619 IFD_BlackLevel ExifTag = 0xc61a IFD_BlackLevelDeltaH ExifTag = 0xc61b IFD_BlackLevelDeltaV ExifTag = 0xc61c IFD_WhiteLevel ExifTag = 0xc61d IFD_DefaultScale ExifTag = 0xc61e IFD_DefaultCropOrigin ExifTag = 0xc61f IFD_DefaultCropSize ExifTag = 0xc620 IFD_ColorMatrix1 ExifTag = 0xc621 IFD_ColorMatrix2 ExifTag = 0xc622 IFD_CameraCalibration1 ExifTag = 0xc623 IFD_CameraCalibration2 ExifTag = 0xc624 IFD_ReductionMatrix1 ExifTag = 0xc625 IFD_ReductionMatrix2 ExifTag = 0xc626 IFD_AnalogBalance ExifTag = 0xc627 IFD_AsShotNeutral ExifTag = 0xc628 IFD_AsShotWhiteXY ExifTag = 0xc629 IFD_BaselineExposure ExifTag = 0xc62a IFD_BaselineNoise ExifTag = 0xc62b IFD_BaselineSharpness ExifTag = 0xc62c IFD_BayerGreenSplit ExifTag = 0xc62d IFD_LinearResponseLimit ExifTag = 0xc62e IFD_CameraSerialNumber ExifTag = 0xc62f IFD_DNGLensInfo ExifTag = 0xc630 IFD_ChromaBlurRadius ExifTag = 0xc631 IFD_AntiAliasStrength ExifTag = 0xc632 IFD_ShadowScale ExifTag = 0xc633 IFD_DNGPrivateData ExifTag = 0xc634 IFD_MakerNoteSafety ExifTag = 0xc635 IFD_CalibrationIlluminant1 ExifTag = 0xc65a IFD_CalibrationIlluminant2 ExifTag = 0xc65b IFD_BestQualityScale ExifTag = 0xc65c IFD_RawDataUniqueID ExifTag = 0xc65d IFD_OriginalRawFileName ExifTag = 0xc68b IFD_OriginalRawFileData ExifTag = 0xc68c IFD_ActiveArea ExifTag = 0xc68d IFD_MaskedAreas ExifTag = 0xc68e IFD_AsShotICCProfile ExifTag = 0xc68f IFD_AsShotPreProfileMatrix ExifTag = 0xc690 IFD_CurrentICCProfile ExifTag = 0xc691 IFD_CurrentPreProfileMatrix ExifTag = 0xc692 IFD_ColorimetricReference ExifTag = 0xc6bf IFD_SRawType ExifTag = 0xc6c5 IFD_PanasonicTitle ExifTag = 0xc6d2 IFD_PanasonicTitle2 ExifTag = 0xc6d3 IFD_CameraCalibrationSig ExifTag = 0xc6f3 IFD_ProfileCalibrationSig ExifTag = 0xc6f4 IFD_ProfileIFD ExifTag = 0xc6f5 IFD_AsShotProfileName ExifTag = 0xc6f6 IFD_NoiseReductionApplied ExifTag = 0xc6f7 IFD_ProfileName ExifTag = 0xc6f8 IFD_ProfileHueSatMapDims ExifTag = 0xc6f9 IFD_ProfileHueSatMapData1 ExifTag = 0xc6fa IFD_ProfileHueSatMapData2 ExifTag = 0xc6fb IFD_ProfileToneCurve ExifTag = 0xc6fc IFD_ProfileEmbedPolicy ExifTag = 0xc6fd IFD_ProfileCopyright ExifTag = 0xc6fe IFD_ForwardMatrix1 ExifTag = 0xc714 IFD_ForwardMatrix2 ExifTag = 0xc715 IFD_PreviewApplicationName ExifTag = 0xc716 IFD_PreviewApplicationVersion ExifTag = 0xc717 IFD_PreviewSettingsName ExifTag = 0xc718 IFD_PreviewSettingsDigest ExifTag = 0xc719 IFD_PreviewColorSpace ExifTag = 0xc71a IFD_PreviewDateTime ExifTag = 0xc71b IFD_RawImageDigest ExifTag = 0xc71c IFD_OriginalRawFileDigest ExifTag = 0xc71d IFD_ProfileLookTableDims ExifTag = 0xc725 IFD_ProfileLookTableData ExifTag = 0xc726 IFD_OpcodeList1 ExifTag = 0xc740 IFD_OpcodeList2 ExifTag = 0xc741 IFD_OpcodeList3 ExifTag = 0xc74e IFD_NoiseProfile ExifTag = 0xc761 IFD_TimeCodes ExifTag = 0xc763 IFD_FrameRate ExifTag = 0xc764 IFD_TStop ExifTag = 0xc772 IFD_ReelName ExifTag = 0xc789 IFD_OriginalDefaultFinalSize ExifTag = 0xc791 IFD_OriginalBestQualitySize ExifTag = 0xc792 IFD_OriginalDefaultCropSize ExifTag = 0xc793 IFD_CameraLabel ExifTag = 0xc7a1 IFD_ProfileHueSatMapEncoding ExifTag = 0xc7a3 IFD_ProfileLookTableEncoding ExifTag = 0xc7a4 IFD_BaselineExposureOffset ExifTag = 0xc7a5 IFD_DefaultBlackRender ExifTag = 0xc7a6 IFD_NewRawImageDigest ExifTag = 0xc7a7 IFD_RawToPreviewGain ExifTag = 0xc7a8 IFD_CacheVersion ExifTag = 0xc7aa IFD_DefaultUserCrop ExifTag = 0xc7b5 IFD_DepthFormat ExifTag = 0xc7e9 IFD_DepthNear ExifTag = 0xc7ea IFD_DepthFar ExifTag = 0xc7eb IFD_DepthUnits ExifTag = 0xc7ec IFD_DepthMeasureType ExifTag = 0xc7ed IFD_EnhanceParams ExifTag = 0xc7ee IFD_ProfileGainTableMap ExifTag = 0xcd2d IFD_SemanticName ExifTag = 0xcd2e IFD_SemanticInstanceIFD ExifTag = 0xcd30 IFD_CalibrationIlluminant3 ExifTag = 0xcd31 IFD_CameraCalibration3 ExifTag = 0xcd32 IFD_ColorMatrix3 ExifTag = 0xcd33 IFD_ForwardMatrix3 ExifTag = 0xcd34 IFD_IlluminantData1 ExifTag = 0xcd35 IFD_IlluminantData2 ExifTag = 0xcd36 IFD_IlluminantData3 ExifTag = 0xcd37 IFD_MaskSubArea ExifTag = 0xcd38 IFD_ProfileHueSatMapData3 ExifTag = 0xcd39 IFD_ReductionMatrix3 ExifTag = 0xcd3a IFD_RGBTables ExifTag = 0xcd3b )
IFD Tag Ids (includes all IFD, IFD1, etc tags)
const ( ExifIFD_FreeOffsets ExifTag = 0x0120 ExifIFD_FreeByteCounts ExifTag = 0x0121 ExifIFD_GrayResponseCurve ExifTag = 0x0123 ExifIFD_T4Options ExifTag = 0x0124 ExifIFD_T6Options ExifTag = 0x0125 ExifIFD_ColorMap ExifTag = 0x0140 ExifIFD_TileOffsets ExifTag = 0x0144 ExifIFD_TileByteCounts ExifTag = 0x0145 ExifIFD_CleanFaxData ExifTag = 0x0147 ExifIFD_ExtraSamples ExifTag = 0x0152 ExifIFD_Indexed ExifTag = 0x015a ExifIFD_JPEGTables ExifTag = 0x015b ExifIFD_OPIProxy ExifTag = 0x015f ExifIFD_GlobalParametersIFD ExifTag = 0x0190 ExifIFD_ProfileType ExifTag = 0x0191 ExifIFD_FaxProfile ExifTag = 0x0192 ExifIFD_CodingMethods ExifTag = 0x0193 ExifIFD_JPEGTables_0x01b5 ExifTag = 0x01b5 ExifIFD_JPEGProc ExifTag = 0x0200 ExifIFD_JPEGQTables ExifTag = 0x0207 ExifIFD_JPEGDCTables ExifTag = 0x0208 ExifIFD_JPEGACTables ExifTag = 0x0209 ExifIFD_XP_DIP_XML ExifTag = 0x4747 ExifIFD_StitchInfo ExifTag = 0x4748 ExifIFD_SonyRawFileType ExifTag = 0x7000 ExifIFD_SonyToneCurve ExifTag = 0x7010 ExifIFD_WangTag1 ExifTag = 0x80a3 ExifIFD_WangAnnotation ExifTag = 0x80a4 ExifIFD_WangTag3 ExifTag = 0x80a5 ExifIFD_WangTag4 ExifTag = 0x80a6 ExifIFD_BatteryLevel ExifTag = 0x828f ExifIFD_KodakIFD ExifTag = 0x8290 ExifIFD_ExposureTime ExifTag = 0x829a ExifIFD_FNumber ExifTag = 0x829d ExifIFD_MDFileTag ExifTag = 0x82a5 ExifIFD_RasterPadding ExifTag = 0x84e3 ExifIFD_ImageColorIndicator ExifTag = 0x84e7 ExifIFD_BackgroundColorIndicator ExifTag = 0x84e8 ExifIFD_HCUsage ExifTag = 0x84ee ExifIFD_AFCP_IPTC ExifTag = 0x8568 ExifIFD_WB_GRGBLevels ExifTag = 0x8602 ExifIFD_LeafData ExifTag = 0x8606 ExifIFD_TIFF_FXExtensions ExifTag = 0x877f ExifIFD_MultiProfiles ExifTag = 0x8780 ExifIFD_ExposureProgram ExifTag = 0x8822 ExifIFD_SpectralSensitivity ExifTag = 0x8824 ExifIFD_ISO ExifTag = 0x8827 ExifIFD_OptoElectricConvFactor ExifTag = 0x8828 ExifIFD_TimeZoneOffset ExifTag = 0x882a ExifIFD_SelfTimerMode ExifTag = 0x882b ExifIFD_SensitivityType ExifTag = 0x8830 ExifIFD_StandardOutputSensitivity ExifTag = 0x8831 ExifIFD_RecommendedExposureIndex ExifTag = 0x8832 ExifIFD_ISOSpeed ExifTag = 0x8833 ExifIFD_ISOSpeedLatitudeyyy ExifTag = 0x8834 ExifIFD_ISOSpeedLatitudezzz ExifTag = 0x8835 ExifIFD_LeafSubIFD ExifTag = 0x888a ExifIFD_ExifVersion ExifTag = 0x9000 ExifIFD_DateTimeOriginal ExifTag = 0x9003 ExifIFD_CreateDate ExifTag = 0x9004 ExifIFD_GooglePlusUploadCode ExifTag = 0x9009 ExifIFD_OffsetTime ExifTag = 0x9010 ExifIFD_OffsetTimeOriginal ExifTag = 0x9011 ExifIFD_OffsetTimeDigitized ExifTag = 0x9012 ExifIFD_ComponentsConfiguration ExifTag = 0x9101 ExifIFD_CompressedBitsPerPixel ExifTag = 0x9102 ExifIFD_ShutterSpeedValue ExifTag = 0x9201 ExifIFD_ApertureValue ExifTag = 0x9202 ExifIFD_BrightnessValue ExifTag = 0x9203 ExifIFD_ExposureCompensation ExifTag = 0x9204 ExifIFD_MaxApertureValue ExifTag = 0x9205 ExifIFD_SubjectDistance ExifTag = 0x9206 ExifIFD_MeteringMode ExifTag = 0x9207 ExifIFD_LightSource ExifTag = 0x9208 ExifIFD_Flash ExifTag = 0x9209 ExifIFD_FocalLength ExifTag = 0x920a ExifIFD_FlashEnergy ExifTag = 0x920b ExifIFD_FocalPlaneResolutionUnit ExifTag = 0x9210 ExifIFD_ImageNumber ExifTag = 0x9211 ExifIFD_SecurityClassification ExifTag = 0x9212 ExifIFD_ImageHistory ExifTag = 0x9213 ExifIFD_SubjectArea ExifTag = 0x9214 ExifIFD_SensingMethod ExifTag = 0x9217 ExifIFD_MakerNote ExifTag = 0x927c ExifIFD_UserComment ExifTag = 0x9286 ExifIFD_SubSecTime ExifTag = 0x9290 ExifIFD_SubSecTimeOriginal ExifTag = 0x9291 ExifIFD_SubSecTimeDigitized ExifTag = 0x9292 ExifIFD_MSPropertySetStorage ExifTag = 0x9330 ExifIFD_MSDocumentTextPosition ExifTag = 0x9331 ExifIFD_AmbientTemperature ExifTag = 0x9400 ExifIFD_Humidity ExifTag = 0x9401 ExifIFD_Pressure ExifTag = 0x9402 ExifIFD_WaterDepth ExifTag = 0x9403 ExifIFD_Acceleration ExifTag = 0x9404 ExifIFD_CameraElevationAngle ExifTag = 0x9405 ExifIFD_FlashpixVersion ExifTag = 0xa000 ExifIFD_ColorSpace ExifTag = 0xa001 ExifIFD_ExifImageWidth ExifTag = 0xa002 ExifIFD_ExifImageHeight ExifTag = 0xa003 ExifIFD_RelatedSoundFile ExifTag = 0xa004 ExifIFD_InteropOffset ExifTag = 0xa005 ExifIFD_SamsungRawPointersOffset ExifTag = 0xa010 ExifIFD_SamsungRawPointersLength ExifTag = 0xa011 ExifIFD_SamsungRawByteOrder ExifTag = 0xa101 ExifIFD_SamsungRawUnknown ExifTag = 0xa102 ExifIFD_FlashEnergy_0xa20b ExifTag = 0xa20b ExifIFD_SpatialFrequencyResponse ExifTag = 0xa20c ExifIFD_FocalPlaneXResolution ExifTag = 0xa20e ExifIFD_FocalPlaneYResolution ExifTag = 0xa20f ExifIFD_FocalPlaneResolutionUnit_0xa210 ExifTag = 0xa210 ExifIFD_SubjectLocation ExifTag = 0xa214 ExifIFD_ExposureIndex ExifTag = 0xa215 ExifIFD_SensingMethod_0xa217 ExifTag = 0xa217 ExifIFD_FileSource ExifTag = 0xa300 ExifIFD_SceneType ExifTag = 0xa301 ExifIFD_CFAPattern ExifTag = 0xa302 ExifIFD_CustomRendered ExifTag = 0xa401 ExifIFD_ExposureMode ExifTag = 0xa402 ExifIFD_WhiteBalance ExifTag = 0xa403 ExifIFD_DigitalZoomRatio ExifTag = 0xa404 ExifIFD_FocalLengthIn35mmFormat ExifTag = 0xa405 ExifIFD_SceneCaptureType ExifTag = 0xa406 ExifIFD_GainControl ExifTag = 0xa407 ExifIFD_Contrast ExifTag = 0xa408 ExifIFD_Saturation ExifTag = 0xa409 ExifIFD_Sharpness ExifTag = 0xa40a ExifIFD_DeviceSettingDescription ExifTag = 0xa40b ExifIFD_SubjectDistanceRange ExifTag = 0xa40c ExifIFD_ImageUniqueID ExifTag = 0xa420 ExifIFD_OwnerName ExifTag = 0xa430 ExifIFD_SerialNumber ExifTag = 0xa431 ExifIFD_LensInfo ExifTag = 0xa432 ExifIFD_LensMake ExifTag = 0xa433 ExifIFD_LensModel ExifTag = 0xa434 ExifIFD_LensSerialNumber ExifTag = 0xa435 ExifIFD_CompositeImage ExifTag = 0xa460 ExifIFD_CompositeImageCount ExifTag = 0xa461 ExifIFD_CompositeImageExposureTimes ExifTag = 0xa462 ExifIFD_Gamma ExifTag = 0xa500 ExifIFD_HasselbladRawImage ExifTag = 0xb4c3 ExifIFD_PixelFormat ExifTag = 0xbc01 ExifIFD_Transformation ExifTag = 0xbc02 ExifIFD_Uncompressed ExifTag = 0xbc03 ExifIFD_ImageType ExifTag = 0xbc04 ExifIFD_ImageOffset ExifTag = 0xbcc0 ExifIFD_ImageByteCount ExifTag = 0xbcc1 ExifIFD_AlphaOffset ExifTag = 0xbcc2 ExifIFD_AlphaByteCount ExifTag = 0xbcc3 ExifIFD_ImageDataDiscard ExifTag = 0xbcc4 ExifIFD_AlphaDataDiscard ExifTag = 0xbcc5 ExifIFD_Annotations ExifTag = 0xc44f ExifIFD_HasselbladExif ExifTag = 0xc51b ExifIFD_OriginalFileName ExifTag = 0xc573 ExifIFD_USPTOOriginalContentType ExifTag = 0xc580 ExifIFD_CR2CFAPattern ExifTag = 0xc5e0 ExifIFD_RawImageSegmentation ExifTag = 0xc640 ExifIFD_AliasLayerMetadata ExifTag = 0xc660 ExifIFD_NikonNEFInfo ExifTag = 0xc7d5 ExifIFD_Padding ExifTag = 0xea1c ExifIFD_OffsetSchema ExifTag = 0xea1d ExifIFD_OwnerName_0xfde8 ExifTag = 0xfde8 ExifIFD_SerialNumber_0xfde9 ExifTag = 0xfde9 ExifIFD_Lens ExifTag = 0xfdea ExifIFD_KDC_IFD ExifTag = 0xfe00 ExifIFD_RawFile ExifTag = 0xfe4c ExifIFD_Converter ExifTag = 0xfe4d ExifIFD_WhiteBalance_0xfe4e ExifTag = 0xfe4e ExifIFD_Exposure ExifTag = 0xfe51 ExifIFD_Shadows ExifTag = 0xfe52 ExifIFD_Brightness ExifTag = 0xfe53 ExifIFD_Contrast_0xfe54 ExifTag = 0xfe54 ExifIFD_Saturation_0xfe55 ExifTag = 0xfe55 ExifIFD_Sharpness_0xfe56 ExifTag = 0xfe56 ExifIFD_Smoothness ExifTag = 0xfe57 ExifIFD_MoireFilter ExifTag = 0xfe58 )
ExifIFD Tag Ids
const ( InteropIFD_InteropIndex ExifTag = 0x0001 InteropIFD_InteropVersion ExifTag = 0x0002 InteropIFD_RelatedImageFileFormat ExifTag = 0x1000 InteropIFD_RelatedImageWidth ExifTag = 0x1001 InteropIFD_RelatedImageHeight ExifTag = 0x1002 )
InteropIFD Tag Ids
const ( GpsIFD_GPSVersionID ExifTag = 0x0000 GpsIFD_GPSLatitudeRef ExifTag = 0x0001 GpsIFD_GPSLatitude ExifTag = 0x0002 GpsIFD_GPSLongitudeRef ExifTag = 0x0003 GpsIFD_GPSLongitude ExifTag = 0x0004 GpsIFD_GPSAltitudeRef ExifTag = 0x0005 GpsIFD_GPSAltitude ExifTag = 0x0006 GpsIFD_GPSTimeStamp ExifTag = 0x0007 GpsIFD_GPSSatellites ExifTag = 0x0008 GpsIFD_GPSStatus ExifTag = 0x0009 GpsIFD_GPSMeasureMode ExifTag = 0x000a GpsIFD_GPSDOP ExifTag = 0x000b GpsIFD_GPSSpeedRef ExifTag = 0x000c GpsIFD_GPSSpeed ExifTag = 0x000d GpsIFD_GPSTrackRef ExifTag = 0x000e GpsIFD_GPSTrack ExifTag = 0x000f GpsIFD_GPSImgDirectionRef ExifTag = 0x0010 GpsIFD_GPSImgDirection ExifTag = 0x0011 GpsIFD_GPSMapDatum ExifTag = 0x0012 GpsIFD_GPSDestLatitudeRef ExifTag = 0x0013 GpsIFD_GPSDestLatitude ExifTag = 0x0014 GpsIFD_GPSDestLongitudeRef ExifTag = 0x0015 GpsIFD_GPSDestLongitude ExifTag = 0x0016 GpsIFD_GPSDestBearingRef ExifTag = 0x0017 GpsIFD_GPSDestBearing ExifTag = 0x0018 GpsIFD_GPSDestDistanceRef ExifTag = 0x0019 GpsIFD_GPSDestDistance ExifTag = 0x001a GpsIFD_GPSProcessingMethod ExifTag = 0x001b GpsIFD_GPSAreaInformation ExifTag = 0x001c GpsIFD_GPSDateStamp ExifTag = 0x001d GpsIFD_GPSDifferential ExifTag = 0x001e GpsIFD_GPSHPositioningError ExifTag = 0x001f )
GpsIFD Tag Ids
type ExifTagDesc ¶
type ExifTagDesc struct { Id ExifTag `json:"id"` Name string `json:"name"` Type ExifTagType `json:"type"` Mandatory bool `json:"mandatory"` Ifd ExifIndex `json:"ifd"` Count int `json:"count"` Offset bool `json:"offset"` OffsetPair ExifTag `json:"offsetPair"` Permanent bool `json:"permanent"` Protected bool `json:"protected"` Values interface{} `json:"values"` }
type ExifTagType ¶
type ExifTagType uint8
const ( ExifString ExifTagType = iota ExifUint8 ExifUint16 ExifUint32 ExifInt16 ExifInt32 ExifRational ExifUrational ExifFloat ExifDouble ExifUndef )
type IptcData ¶
type IptcData struct {
// contains filtered or unexported fields
}
IptcData holds a map of iptc record tags
func NewIptcData ¶
func NewIptcData(segments *jpegstructure.SegmentList) (*IptcData, error)
NewIptcData creates IptcData from a jpeg segment list
func (*IptcData) GetDate ¶
GetDate retrieves the given date value (including time if exists). In case of an error/missing date returns zero time
func (*IptcData) GetKeywords ¶
GetKeywords retrieves IPTCApplication_Keywords. Returnes an empty slice in case of an error
func (*IptcData) GetTitle ¶
GetTitle retrieves the IPTCApplication_ObjectName. Returns the empty string in case of an error
func (*IptcData) RawIptc ¶
func (ipd *IptcData) RawIptc() map[IptcRecordTag]IptcRecordDataset
RawIptc returns the raw iptc data
func (*IptcData) Scan ¶
func (ipd *IptcData) Scan(record IptcRecord, tag IptcTag, dest interface{}) error
Scan reads tag from record into dest
func (*IptcData) ScanApplication ¶
ScanApplication reads tag from IPTCApplication into dest
func (*IptcData) ScanEnvelope ¶
ScanEnvelope reads tag from IPTCEnvelope into dest
type IptcEditor ¶
type IptcEditor struct {
// contains filtered or unexported fields
}
IptcEditor holds raw iptc data
func NewIptcEditor ¶
func NewIptcEditor(sl *jpegstructure.SegmentList) (*IptcEditor, error)
NewIptcEditor from a jpeg segment list
func NewIptcEditorEmpty ¶
func NewIptcEditorEmpty(dirty bool) *IptcEditor
NewIptcEditorEmpty creates a new empty IptcEditor
func (*IptcEditor) Bytes ¶
func (ie *IptcEditor) Bytes() ([]byte, error)
Bytes generate Photoshop Image Resource block including IPTC information
func (*IptcEditor) Clear ¶
func (ie *IptcEditor) Clear(dirty bool)
Clear this model and set the dirty property
func (IptcEditor) IsDirty ¶
func (ie IptcEditor) IsDirty() bool
IsDirty returns true if the IptcData has been changed
func (IptcEditor) IsEmpty ¶
func (ie IptcEditor) IsEmpty() bool
IsEmpty returns true if this editor contains no data
func (*IptcEditor) Set ¶
func (ie *IptcEditor) Set(record IptcRecord, tag IptcTag, value interface{}) error
Set sets record with tag to value
func (*IptcEditor) SetDate ¶
func (ie *IptcEditor) SetDate(dateTag IptcDate, t time.Time) error
SetDate set the given dateTag to to T. This will set both the corresponding Date and Time tags
func (*IptcEditor) SetEnvelope ¶
func (ie *IptcEditor) SetEnvelope(tag IptcTag, value interface{}) error
SetEnvelope set IPTCEnvelop tag to value
func (*IptcEditor) SetKeywords ¶
func (ie *IptcEditor) SetKeywords(keywords []string) error
SetKeywords sets IPTCApplication_Keywords to keywords
func (*IptcEditor) SetTitle ¶
func (ie *IptcEditor) SetTitle(title string) error
SetTitle sets IPTCApplication_ObjectName to title
type IptcRecord ¶
type IptcRecord uint8
const ( IPTCObjectData IptcRecord = 8 IPTCPostObjectData IptcRecord = 9 IPTCPreObjectData IptcRecord = 7 IPTCApplication IptcRecord = 2 IPTCEnvelope IptcRecord = 1 IPTCFotoStation IptcRecord = 240 IPTCNewsPhoto IptcRecord = 3 )
type IptcRecordDataset ¶
type IptcRecordDataset struct { Record IptcRecord Tag IptcTag Data interface{} Type IptcTagType Repeatable bool }
IptcRecordDataset contains the iptc data for a Record/Tag. If Repeatable is true the Data will be of type slice
type IptcRecordTag ¶
type IptcRecordTag struct { Record IptcRecord Tag IptcTag }
type IptcTag ¶
type IptcTag uint8
const ( IPTCApplication_ObjectPreviewData IptcTag = 202 IPTCApplication_ShortDocumentID IptcTag = 186 IPTCApplication_MasterDocumentID IptcTag = 185 IPTCApplication_ExpirationDate IptcTag = 37 IPTCApplication_AudioSamplingRate IptcTag = 151 IPTCApplication_CountryPrimaryLocationCode IptcTag = 100 IPTCApplication_UniqueDocumentID IptcTag = 187 IPTCApplication_SimilarityIndex IptcTag = 228 IPTCApplication_ReferenceService IptcTag = 45 IPTCApplication_Keywords IptcTag = 25 IPTCApplication_WriterEditor IptcTag = 122 IPTCApplication_ProgramVersion IptcTag = 70 IPTCApplication_OriginalTransmissionReference IptcTag = 103 IPTCApplication_DocumentNotes IptcTag = 230 IPTCApplication_Byline IptcTag = 80 IPTCApplication_OriginatingProgram IptcTag = 65 IPTCApplication_DateCreated IptcTag = 55 IPTCApplication_ReleaseTime IptcTag = 35 IPTCApplication_ExpirationTime IptcTag = 38 IPTCApplication_ImageType IptcTag = 130 IPTCApplication_ContentLocationCode IptcTag = 26 IPTCApplication_Category IptcTag = 15 IPTCApplication_ExifCameraInfo IptcTag = 232 IPTCApplication_CaptionAbstract IptcTag = 120 IPTCApplication_CopyrightNotice IptcTag = 116 IPTCApplication_ContentLocationName IptcTag = 27 IPTCApplication_ReferenceDate IptcTag = 47 IPTCApplication_EditorialUpdate IptcTag = 8 IPTCApplication_Source IptcTag = 115 IPTCApplication_EditStatus IptcTag = 7 IPTCApplication_ObjectPreviewFileFormat IptcTag = 200 IPTCApplication_ProvinceState IptcTag = 95 IPTCApplication_CatalogSets IptcTag = 255 IPTCApplication_JobID IptcTag = 184 IPTCApplication_ActionAdvised IptcTag = 42 IPTCApplication_FixtureIdentifier IptcTag = 22 IPTCApplication_AudioOutcue IptcTag = 154 IPTCApplication_ObjectPreviewFileVersion IptcTag = 201 IPTCApplication_ObjectAttributeReference IptcTag = 4 IPTCApplication_Contact IptcTag = 118 IPTCApplication_Credit IptcTag = 110 IPTCApplication_AudioSamplingResolution IptcTag = 152 IPTCApplication_City IptcTag = 90 IPTCApplication_TimeCreated IptcTag = 60 IPTCApplication_ReferenceNumber IptcTag = 50 IPTCApplication_ReleaseDate IptcTag = 30 IPTCApplication_RasterizedCaption IptcTag = 125 IPTCApplication_ImageOrientation IptcTag = 131 IPTCApplication_Urgency IptcTag = 10 IPTCApplication_LocalCaption IptcTag = 121 IPTCApplication_LanguageIdentifier IptcTag = 135 IPTCApplication_Prefs IptcTag = 221 IPTCApplication_SpecialInstructions IptcTag = 40 IPTCApplication_SupplementalCategories IptcTag = 20 IPTCApplication_ApplicationRecordVersion IptcTag = 0 IPTCApplication_ObjectCycle IptcTag = 75 IPTCApplication_ClassifyState IptcTag = 225 IPTCApplication_DocumentHistory IptcTag = 231 IPTCApplication_AudioDuration IptcTag = 153 IPTCApplication_Sublocation IptcTag = 92 IPTCApplication_BylineTitle IptcTag = 85 IPTCApplication_Headline IptcTag = 105 IPTCApplication_DigitalCreationDate IptcTag = 62 IPTCApplication_CountryPrimaryLocationName IptcTag = 101 IPTCApplication_AudioType IptcTag = 150 IPTCApplication_DigitalCreationTime IptcTag = 63 IPTCApplication_ObjectName IptcTag = 5 IPTCApplication_ObjectTypeReference IptcTag = 3 IPTCApplication_OwnerID IptcTag = 188 IPTCApplication_SubjectReference IptcTag = 12 )
IPTCApplication tag constants
const ( IPTCEnvelope_ProductID IptcTag = 50 IPTCEnvelope_EnvelopePriority IptcTag = 60 IPTCEnvelope_ServiceIdentifier IptcTag = 30 IPTCEnvelope_FileVersion IptcTag = 22 IPTCEnvelope_EnvelopeNumber IptcTag = 40 IPTCEnvelope_FileFormat IptcTag = 20 IPTCEnvelope_EnvelopeRecordVersion IptcTag = 0 IPTCEnvelope_ARMVersion IptcTag = 122 IPTCEnvelope_DateSent IptcTag = 70 IPTCEnvelope_UniqueObjectName IptcTag = 100 IPTCEnvelope_Destination IptcTag = 5 IPTCEnvelope_TimeSent IptcTag = 80 IPTCEnvelope_ARMIdentifier IptcTag = 120 IPTCEnvelope_CodedCharacterSet IptcTag = 90 )
IPTCEnvelope tag constants
const ( IPTCNewsPhoto_QuantizationMethod IptcTag = 120 IPTCNewsPhoto_ColorPalette IptcTag = 85 IPTCNewsPhoto_InterchangeColorSpace IptcTag = 64 IPTCNewsPhoto_IPTCImageWidth IptcTag = 20 IPTCNewsPhoto_ExcursionTolerance IptcTag = 130 IPTCNewsPhoto_NewsPhotoVersion IptcTag = 0 IPTCNewsPhoto_NumIndexEntries IptcTag = 84 IPTCNewsPhoto_IPTCPixelWidth IptcTag = 40 IPTCNewsPhoto_ColorSequence IptcTag = 65 IPTCNewsPhoto_SupplementalType IptcTag = 55 IPTCNewsPhoto_IPTCImageRotation IptcTag = 102 IPTCNewsPhoto_MaximumDensityRange IptcTag = 140 IPTCNewsPhoto_SampleStructure IptcTag = 90 IPTCNewsPhoto_ScanningDirection IptcTag = 100 IPTCNewsPhoto_DataCompressionMethod IptcTag = 110 IPTCNewsPhoto_GammaCompensatedValue IptcTag = 145 IPTCNewsPhoto_ICC_Profile IptcTag = 66 IPTCNewsPhoto_BitsPerComponent IptcTag = 135 IPTCNewsPhoto_LookupTable IptcTag = 80 IPTCNewsPhoto_IPTCPictureNumber IptcTag = 10 IPTCNewsPhoto_ColorCalibrationMatrix IptcTag = 70 IPTCNewsPhoto_EndPoints IptcTag = 125 IPTCNewsPhoto_IPTCBitsPerSample IptcTag = 86 IPTCNewsPhoto_IPTCPixelHeight IptcTag = 50 IPTCNewsPhoto_ColorRepresentation IptcTag = 60 IPTCNewsPhoto_IPTCImageHeight IptcTag = 30 )
IPTCNewsPhoto tag constants
const ( IPTCPreObjectData_MaxSubfileSize IptcTag = 20 IPTCPreObjectData_SizeMode IptcTag = 10 IPTCPreObjectData_ObjectSizeAnnounced IptcTag = 90 IPTCPreObjectData_MaximumObjectSize IptcTag = 95 )
IPTCPreObjectData tag constants
const (
IPTCObjectData_SubFile IptcTag = 10
)
IPTCObjectData tag constants
const (
IPTCPostObjectData_ConfirmedObjectSize IptcTag = 10
)
IPTCPostObjectData tag constants
type IptcTagDesc ¶
type IptcTagDesc struct { Id IptcTag `json:"id"` Name string `json:"name"` Type IptcTagType `json:"type"` MinLength int `json:"minLength"` MaxLength int `json:"maxLength"` Mandatory bool `json:"mandatory"` Repeatable bool `json:"repeatable"` Writable bool `json:"writable"` Values interface{} `json:"values"` }
type IptcTagType ¶
type IptcTagType uint8
const ( IptcString IptcTagType = iota IptcDigits IptcUint8 IptcUint16 IptcUint32 IptcUndef )
type JpegEditor ¶
type JpegEditor struct {
// contains filtered or unexported fields
}
JpegEditor holds the exif, xmp and iptc editors as well as the jpeg segment list
func NewJpegEditor ¶
func NewJpegEditor(data []byte) (*JpegEditor, error)
NewJpegEditor from a jpeg image byte slice
func NewJpegEditorFile ¶
func NewJpegEditorFile(fileName string) (*JpegEditor, error)
NewJpegEditorFile from a jpeg image file
func (*JpegEditor) Bytes ¶
func (je *JpegEditor) Bytes() ([]byte, error)
Bytes return jpeg image bytes from this editor. Any edits will be committed
func (*JpegEditor) CopyMetaData ¶
func (je *JpegEditor) CopyMetaData(sourceImg []byte) error
CopyMetaData copies and replaces metadata (xmp,iptc,exif) from sourcImg
func (*JpegEditor) DropExif ¶
func (je *JpegEditor) DropExif() error
DropExif removes exif data from this editor
func (*JpegEditor) DropIptc ¶
func (je *JpegEditor) DropIptc() error
DropIptc removes iptc data from this editor
func (*JpegEditor) DropMetaData ¶
func (je *JpegEditor) DropMetaData() error
DropMetaData removes xmp, exif, iptc data from this editor
func (*JpegEditor) DropXmp ¶
func (je *JpegEditor) DropXmp() error
DropXmp removes xmp data from this editor
func (*JpegEditor) MetaData ¶
func (je *JpegEditor) MetaData() (*MetaData, error)
MetaData returns a metadata struct based on this editor. Will commit any changes first
func (*JpegEditor) SetKeywords ¶
func (je *JpegEditor) SetKeywords(keywords []string) error
SetKeywords sets the keywords in Xmp and Iptc
func (*JpegEditor) SetTitle ¶
func (je *JpegEditor) SetTitle(title string) error
SetTitle sets title in Xmp and Iptc and ImageDescription in Exif
Example ¶
je, err := NewJpegEditorFile("../assets/leica.jpg") if err != nil { fmt.Printf("Could not retrieve editor for file: %v\n", err) return } err = je.SetTitle("some new title") if err != nil { fmt.Printf("Could not set title: %v\n", err) return } md, err := je.MetaData() if err != nil { fmt.Printf("Could not get metadata: %v\n", err) } fmt.Printf("New Title: %v\n", md.Summary().Title)
Output: New Title: some new title
func (*JpegEditor) WriteFile ¶
func (je *JpegEditor) WriteFile(dest string) error
WriteFile writes this editor to file by first committing any edits. Any existing file will be truncated. Destination needs to have jpg or jpeg extension
type LensInfo ¶
type LensInfo struct { MinFocalLength URat `json:"minFocalLength,omitempty"` MaxFocalLength URat `json:"maxFocalLength,omitempty"` MinFNumberMinFocalLength URat `json:"minFNumberMinFocalLength,omitempty"` MinFNumberMaxFocalLength URat `json:"MinFNumberMaxFocalLength,omitempty"` }
LensInfo reprsents an Exif LensInfo object
type MetaData ¶
MetaData keeps xmp, iptc, exif data as well as image dimensions
func NewMetaData ¶
NewMetaData reads a jpeg image byte slice
func NewMetaDataFromFile ¶
NewMetaDataFromFile reads a jpeg image file
Example ¶
md, err := NewMetaDataFromFile("../assets/leica.jpg") if err != nil { fmt.Printf("Could not open file: %v\n", err) return } fmt.Printf("Make: %s, Model: %s\n", md.Summary().CameraMake, md.Summary().CameraModel)
Output: Make: LEICA CAMERA AG, Model: LEICA Q2
func (*MetaData) Summary ¶
Summary parses the metadata and returns its Summary. If the summary has already been parsed returns a cached copy of it
func (*MetaData) SummaryErr ¶
SummaryErr returns any error any error from the Summary parsing
type Summary ¶ added in v0.0.9
type Summary struct { Title string `json:"title,omitempty"` Keywords []string `json:"keywords,omitempty"` Software string `json:"software,omitempty"` Rating uint16 `json:"rating,omitempty"` CameraMake string `json:"cameraMake,omitempty"` CameraModel string `json:"cameraModel,omitempty"` LensInfo LensInfo `json:"lensInfo,omitempty"` LensModel string `json:"lensModel,omitempty"` LensMake string `json:"lensMake,omitempty"` FocalLength URat `json:"focalLength,omitempty"` FocalLengthIn35mmFormat uint16 `json:"focalLengthIn35mmFormat,omitempty"` MaxApertureValue URat `json:"maxApertureValue,omitempty"` FlashMode uint16 `json:"flashMode,omitempty"` ExposureTime URat `json:"exposureTime,omitempty"` ExposureCompensation Rat `json:"exposureCompensation,omitempty"` ExposureProgram uint16 `json:"exposureProgram,omitempty"` FNumber URat `json:"fNumber,omitempty"` ISO uint16 `json:"ISO,omitempty"` ColorSpace uint16 `json:"colorSpace,omitempty"` XResolution URat `json:"xResolution,omitempty"` YResolution URat `json:"yResolution,omitempty"` OriginalDate time.Time `json:"originalDate,omitempty"` ModifyDate time.Time `json:"modifyDate,omitempty"` GPSInfo *exif.GpsInfo `json:"gpsInfo,omitempty"` City string `json:"city,omitempty"` Country string `json:"country,omitempty"` State string `json:"state,omitempty"` }
Summary holds the most common image metadata of interest
type URat ¶
URat represents an unsigned Exif float
type XmpData ¶
type XmpData struct {
// contains filtered or unexported fields
}
XmpData holds the underlying xmp document
func NewXmpData ¶
func NewXmpData(segments *jpegstructure.SegmentList) (XmpData, error)
NewXmpData creates an XmpData struct from a jpeg segment list
func NewXmpDataFromBytes ¶
NewXmpDataFromBytes creates an XmpData struct from marshalled xmp.Document
func (XmpData) DublinCore ¶
func (xd XmpData) DublinCore() *dc.DublinCore
DublinCore retrieves the DublinCore model
func (XmpData) GetKeywords ¶
GetKeywords returns the keywords from DublinCore
func (XmpData) PhotoShop ¶
func (xd XmpData) PhotoShop() *ps.PhotoshopInfo
PhotoShop retrieves the Photoshop Model
type XmpEditor ¶
type XmpEditor struct { XmpData // contains filtered or unexported fields }
XmpEditor add a dirty field to the XmpData
func NewXmpEditor ¶
func NewXmpEditor(sl *jpegstructure.SegmentList) (*XmpEditor, error)
NewXmpEditor from a jpeg segment list
func NewXmpEditorFromBytes ¶
NewXmpEditorFromBytes from a marshalled xmp.Document
func NewXmpEditorFromDocument ¶
NewXmpEditorFromDocument from an xmp.document
func (*XmpEditor) Bytes ¶
Bytes commits any changes and writes the xmpDocument to bytes. If prefix is adds "http://ns.adobe.com/xap/1.0/\000" so it can be added to a jpeg segment list
func (*XmpEditor) SetDirty ¶
func (xe *XmpEditor) SetDirty()
SetDirty force this editor to be marked as dirty
func (*XmpEditor) SetDocument ¶
SetDocument sets the xmp.Document of this editor
func (*XmpEditor) SetKeywords ¶
SetKeywords sets the DublicCore keywords