mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
Merge pull request #378 from kyfk/fix_typo_and_format
Fix typo and apply goimports
This commit is contained in:
commit
585090af42
4 changed files with 265 additions and 265 deletions
302
metadata.go
302
metadata.go
|
|
@ -8,57 +8,57 @@ import "C"
|
||||||
|
|
||||||
// Common EXIF fields for data extraction
|
// Common EXIF fields for data extraction
|
||||||
const (
|
const (
|
||||||
Make = "exif-ifd0-Make"
|
Make = "exif-ifd0-Make"
|
||||||
Model = "exif-ifd0-Model"
|
Model = "exif-ifd0-Model"
|
||||||
Orientation = "exif-ifd0-Orientation"
|
Orientation = "exif-ifd0-Orientation"
|
||||||
XResolution = "exif-ifd0-XResolution"
|
XResolution = "exif-ifd0-XResolution"
|
||||||
YResolution = "exif-ifd0-YResolution"
|
YResolution = "exif-ifd0-YResolution"
|
||||||
ResolutionUnit = "exif-ifd0-ResolutionUnit"
|
ResolutionUnit = "exif-ifd0-ResolutionUnit"
|
||||||
Software = "exif-ifd0-Software"
|
Software = "exif-ifd0-Software"
|
||||||
Datetime = "exif-ifd0-DateTime"
|
Datetime = "exif-ifd0-DateTime"
|
||||||
YCbCrPositioning = "exif-ifd0-YCbCrPositioning"
|
YCbCrPositioning = "exif-ifd0-YCbCrPositioning"
|
||||||
Compression = "exif-ifd1-Compression"
|
Compression = "exif-ifd1-Compression"
|
||||||
ExposureTime = "exif-ifd2-ExposureTime"
|
ExposureTime = "exif-ifd2-ExposureTime"
|
||||||
FNumber = "exif-ifd2-FNumber"
|
FNumber = "exif-ifd2-FNumber"
|
||||||
ExposureProgram = "exif-ifd2-ExposureProgram"
|
ExposureProgram = "exif-ifd2-ExposureProgram"
|
||||||
ISOSpeedRatings = "exif-ifd2-ISOSpeedRatings"
|
ISOSpeedRatings = "exif-ifd2-ISOSpeedRatings"
|
||||||
ExifVersion = "exif-ifd2-ExifVersion"
|
ExifVersion = "exif-ifd2-ExifVersion"
|
||||||
DateTimeOriginal = "exif-ifd2-DateTimeOriginal"
|
DateTimeOriginal = "exif-ifd2-DateTimeOriginal"
|
||||||
DateTimeDigitized = "exif-ifd2-DateTimeDigitized"
|
DateTimeDigitized = "exif-ifd2-DateTimeDigitized"
|
||||||
ComponentsConfiguration = "exif-ifd2-ComponentsConfiguration"
|
ComponentsConfiguration = "exif-ifd2-ComponentsConfiguration"
|
||||||
ShutterSpeedValue = "exif-ifd2-ShutterSpeedValue"
|
ShutterSpeedValue = "exif-ifd2-ShutterSpeedValue"
|
||||||
ApertureValue = "exif-ifd2-ApertureValue"
|
ApertureValue = "exif-ifd2-ApertureValue"
|
||||||
BrightnessValue = "exif-ifd2-BrightnessValue"
|
BrightnessValue = "exif-ifd2-BrightnessValue"
|
||||||
ExposureBiasValue = "exif-ifd2-ExposureBiasValue"
|
ExposureBiasValue = "exif-ifd2-ExposureBiasValue"
|
||||||
MeteringMode = "exif-ifd2-MeteringMode"
|
MeteringMode = "exif-ifd2-MeteringMode"
|
||||||
Flash = "exif-ifd2-Flash"
|
Flash = "exif-ifd2-Flash"
|
||||||
FocalLength = "exif-ifd2-FocalLength"
|
FocalLength = "exif-ifd2-FocalLength"
|
||||||
SubjectArea = "exif-ifd2-SubjectArea"
|
SubjectArea = "exif-ifd2-SubjectArea"
|
||||||
MakerNote = "exif-ifd2-MakerNote"
|
MakerNote = "exif-ifd2-MakerNote"
|
||||||
SubSecTimeOriginal = "exif-ifd2-SubSecTimeOriginal"
|
SubSecTimeOriginal = "exif-ifd2-SubSecTimeOriginal"
|
||||||
SubSecTimeDigitized = "exif-ifd2-SubSecTimeDigitized"
|
SubSecTimeDigitized = "exif-ifd2-SubSecTimeDigitized"
|
||||||
ColorSpace = "exif-ifd2-ColorSpace"
|
ColorSpace = "exif-ifd2-ColorSpace"
|
||||||
PixelXDimension = "exif-ifd2-PixelXDimension"
|
PixelXDimension = "exif-ifd2-PixelXDimension"
|
||||||
PixelYDimension = "exif-ifd2-PixelYDimension"
|
PixelYDimension = "exif-ifd2-PixelYDimension"
|
||||||
SensingMethod = "exif-ifd2-SensingMethod"
|
SensingMethod = "exif-ifd2-SensingMethod"
|
||||||
SceneType = "exif-ifd2-SceneType"
|
SceneType = "exif-ifd2-SceneType"
|
||||||
ExposureMode = "exif-ifd2-ExposureMode"
|
ExposureMode = "exif-ifd2-ExposureMode"
|
||||||
WhiteBalance = "exif-ifd2-WhiteBalance"
|
WhiteBalance = "exif-ifd2-WhiteBalance"
|
||||||
FocalLengthIn35mmFilm = "exif-ifd2-FocalLengthIn35mmFilm"
|
FocalLengthIn35mmFilm = "exif-ifd2-FocalLengthIn35mmFilm"
|
||||||
SceneCaptureType = "exif-ifd2-SceneCaptureType"
|
SceneCaptureType = "exif-ifd2-SceneCaptureType"
|
||||||
GPSLatitudeRef = "exif-ifd3-GPSLatitudeRef"
|
GPSLatitudeRef = "exif-ifd3-GPSLatitudeRef"
|
||||||
GPSLatitude = "exif-ifd3-GPSLatitude"
|
GPSLatitude = "exif-ifd3-GPSLatitude"
|
||||||
GPSLongitudeRef = "exif-ifd3-GPSLongitudeRef"
|
GPSLongitudeRef = "exif-ifd3-GPSLongitudeRef"
|
||||||
GPSLongitude = "exif-ifd3-GPSLongitude"
|
GPSLongitude = "exif-ifd3-GPSLongitude"
|
||||||
GPSAltitudeRef = "exif-ifd3-GPSAltitudeRef"
|
GPSAltitudeRef = "exif-ifd3-GPSAltitudeRef"
|
||||||
GPSAltitude = "exif-ifd3-GPSAltitude"
|
GPSAltitude = "exif-ifd3-GPSAltitude"
|
||||||
GPSSpeedRef = "exif-ifd3-GPSSpeedRef"
|
GPSSpeedRef = "exif-ifd3-GPSSpeedRef"
|
||||||
GPSSpeed = "exif-ifd3-GPSSpeed"
|
GPSSpeed = "exif-ifd3-GPSSpeed"
|
||||||
GPSImgDirectionRef = "exif-ifd3-GPSImgDirectionRef"
|
GPSImgDirectionRef = "exif-ifd3-GPSImgDirectionRef"
|
||||||
GPSImgDirection = "exif-ifd3-GPSImgDirection"
|
GPSImgDirection = "exif-ifd3-GPSImgDirection"
|
||||||
GPSDestBearingRef = "exif-ifd3-GPSDestBearingRef"
|
GPSDestBearingRef = "exif-ifd3-GPSDestBearingRef"
|
||||||
GPSDestBearing = "exif-ifd3-GPSDestBearing"
|
GPSDestBearing = "exif-ifd3-GPSDestBearing"
|
||||||
GPSDateStamp = "exif-ifd3-GPSDateStamp"
|
GPSDateStamp = "exif-ifd3-GPSDateStamp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImageSize represents the image width and height values
|
// ImageSize represents the image width and height values
|
||||||
|
|
@ -77,62 +77,62 @@ type ImageMetadata struct {
|
||||||
Space string
|
Space string
|
||||||
Colourspace string
|
Colourspace string
|
||||||
Size ImageSize
|
Size ImageSize
|
||||||
EXIF EXIF
|
EXIF EXIF
|
||||||
}
|
}
|
||||||
|
|
||||||
// EXIF image metadata
|
// EXIF image metadata
|
||||||
type EXIF struct {
|
type EXIF struct {
|
||||||
Make string
|
Make string
|
||||||
Model string
|
Model string
|
||||||
Orientation int
|
Orientation int
|
||||||
XResolution string
|
XResolution string
|
||||||
YResolution string
|
YResolution string
|
||||||
ResolutionUnit int
|
ResolutionUnit int
|
||||||
Software string
|
Software string
|
||||||
Datetime string
|
Datetime string
|
||||||
YCbCrPositioning int
|
YCbCrPositioning int
|
||||||
Compression int
|
Compression int
|
||||||
ExposureTime string
|
ExposureTime string
|
||||||
FNumber string
|
FNumber string
|
||||||
ExposureProgram int
|
ExposureProgram int
|
||||||
ISOSpeedRatings int
|
ISOSpeedRatings int
|
||||||
ExifVersion string
|
ExifVersion string
|
||||||
DateTimeOriginal string
|
DateTimeOriginal string
|
||||||
DateTimeDigitized string
|
DateTimeDigitized string
|
||||||
ComponentsConfiguration string
|
ComponentsConfiguration string
|
||||||
ShutterSpeedValue string
|
ShutterSpeedValue string
|
||||||
ApertureValue string
|
ApertureValue string
|
||||||
BrightnessValue string
|
BrightnessValue string
|
||||||
ExposureBiasValue string
|
ExposureBiasValue string
|
||||||
MeteringMode int
|
MeteringMode int
|
||||||
Flash int
|
Flash int
|
||||||
FocalLength string
|
FocalLength string
|
||||||
SubjectArea string
|
SubjectArea string
|
||||||
MakerNote string
|
MakerNote string
|
||||||
SubSecTimeOriginal string
|
SubSecTimeOriginal string
|
||||||
SubSecTimeDigitized string
|
SubSecTimeDigitized string
|
||||||
ColorSpace int
|
ColorSpace int
|
||||||
PixelXDimension int
|
PixelXDimension int
|
||||||
PixelYDimension int
|
PixelYDimension int
|
||||||
SensingMethod int
|
SensingMethod int
|
||||||
SceneType string
|
SceneType string
|
||||||
ExposureMode int
|
ExposureMode int
|
||||||
WhiteBalance int
|
WhiteBalance int
|
||||||
FocalLengthIn35mmFilm int
|
FocalLengthIn35mmFilm int
|
||||||
SceneCaptureType int
|
SceneCaptureType int
|
||||||
GPSLatitudeRef string
|
GPSLatitudeRef string
|
||||||
GPSLatitude string
|
GPSLatitude string
|
||||||
GPSLongitudeRef string
|
GPSLongitudeRef string
|
||||||
GPSLongitude string
|
GPSLongitude string
|
||||||
GPSAltitudeRef string
|
GPSAltitudeRef string
|
||||||
GPSAltitude string
|
GPSAltitude string
|
||||||
GPSSpeedRef string
|
GPSSpeedRef string
|
||||||
GPSSpeed string
|
GPSSpeed string
|
||||||
GPSImgDirectionRef string
|
GPSImgDirectionRef string
|
||||||
GPSImgDirection string
|
GPSImgDirection string
|
||||||
GPSDestBearingRef string
|
GPSDestBearingRef string
|
||||||
GPSDestBearing string
|
GPSDestBearing string
|
||||||
GPSDateStamp string
|
GPSDateStamp string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns the image size by width and height pixels.
|
// Size returns the image size by width and height pixels.
|
||||||
|
|
@ -185,57 +185,57 @@ func Metadata(buf []byte) (ImageMetadata, error) {
|
||||||
Space: vipsSpace(image),
|
Space: vipsSpace(image),
|
||||||
Type: ImageTypeName(imageType),
|
Type: ImageTypeName(imageType),
|
||||||
EXIF: EXIF{
|
EXIF: EXIF{
|
||||||
Make: vipsExifStringTag(image, Make),
|
Make: vipsExifStringTag(image, Make),
|
||||||
Model: vipsExifStringTag(image, Model),
|
Model: vipsExifStringTag(image, Model),
|
||||||
Orientation: orientation,
|
Orientation: orientation,
|
||||||
XResolution: vipsExifStringTag(image, XResolution),
|
XResolution: vipsExifStringTag(image, XResolution),
|
||||||
YResolution: vipsExifStringTag(image, YResolution),
|
YResolution: vipsExifStringTag(image, YResolution),
|
||||||
ResolutionUnit: vipsExifIntTag(image, ResolutionUnit),
|
ResolutionUnit: vipsExifIntTag(image, ResolutionUnit),
|
||||||
Software: vipsExifStringTag(image, Software),
|
Software: vipsExifStringTag(image, Software),
|
||||||
Datetime: vipsExifStringTag(image, Datetime),
|
Datetime: vipsExifStringTag(image, Datetime),
|
||||||
YCbCrPositioning: vipsExifIntTag(image, YCbCrPositioning),
|
YCbCrPositioning: vipsExifIntTag(image, YCbCrPositioning),
|
||||||
Compression: vipsExifIntTag(image, Compression),
|
Compression: vipsExifIntTag(image, Compression),
|
||||||
ExposureTime: vipsExifStringTag(image, ExposureTime),
|
ExposureTime: vipsExifStringTag(image, ExposureTime),
|
||||||
FNumber: vipsExifStringTag(image, FNumber),
|
FNumber: vipsExifStringTag(image, FNumber),
|
||||||
ExposureProgram: vipsExifIntTag(image, ExposureProgram),
|
ExposureProgram: vipsExifIntTag(image, ExposureProgram),
|
||||||
ISOSpeedRatings: vipsExifIntTag(image, ISOSpeedRatings),
|
ISOSpeedRatings: vipsExifIntTag(image, ISOSpeedRatings),
|
||||||
ExifVersion: vipsExifStringTag(image, ExifVersion),
|
ExifVersion: vipsExifStringTag(image, ExifVersion),
|
||||||
DateTimeOriginal: vipsExifStringTag(image, DateTimeOriginal),
|
DateTimeOriginal: vipsExifStringTag(image, DateTimeOriginal),
|
||||||
DateTimeDigitized: vipsExifStringTag(image, DateTimeDigitized),
|
DateTimeDigitized: vipsExifStringTag(image, DateTimeDigitized),
|
||||||
ComponentsConfiguration: vipsExifStringTag(image, ComponentsConfiguration),
|
ComponentsConfiguration: vipsExifStringTag(image, ComponentsConfiguration),
|
||||||
ShutterSpeedValue: vipsExifStringTag(image, ShutterSpeedValue),
|
ShutterSpeedValue: vipsExifStringTag(image, ShutterSpeedValue),
|
||||||
ApertureValue: vipsExifStringTag(image, ApertureValue),
|
ApertureValue: vipsExifStringTag(image, ApertureValue),
|
||||||
BrightnessValue: vipsExifStringTag(image, BrightnessValue),
|
BrightnessValue: vipsExifStringTag(image, BrightnessValue),
|
||||||
ExposureBiasValue: vipsExifStringTag(image, ExposureBiasValue),
|
ExposureBiasValue: vipsExifStringTag(image, ExposureBiasValue),
|
||||||
MeteringMode: vipsExifIntTag(image, MeteringMode),
|
MeteringMode: vipsExifIntTag(image, MeteringMode),
|
||||||
Flash: vipsExifIntTag(image, Flash),
|
Flash: vipsExifIntTag(image, Flash),
|
||||||
FocalLength: vipsExifStringTag(image, FocalLength),
|
FocalLength: vipsExifStringTag(image, FocalLength),
|
||||||
SubjectArea: vipsExifStringTag(image, SubjectArea),
|
SubjectArea: vipsExifStringTag(image, SubjectArea),
|
||||||
MakerNote: vipsExifStringTag(image, MakerNote),
|
MakerNote: vipsExifStringTag(image, MakerNote),
|
||||||
SubSecTimeOriginal: vipsExifStringTag(image, SubSecTimeOriginal),
|
SubSecTimeOriginal: vipsExifStringTag(image, SubSecTimeOriginal),
|
||||||
SubSecTimeDigitized: vipsExifStringTag(image, SubSecTimeDigitized),
|
SubSecTimeDigitized: vipsExifStringTag(image, SubSecTimeDigitized),
|
||||||
ColorSpace: vipsExifIntTag(image, ColorSpace),
|
ColorSpace: vipsExifIntTag(image, ColorSpace),
|
||||||
PixelXDimension: vipsExifIntTag(image, PixelXDimension),
|
PixelXDimension: vipsExifIntTag(image, PixelXDimension),
|
||||||
PixelYDimension: vipsExifIntTag(image, PixelYDimension),
|
PixelYDimension: vipsExifIntTag(image, PixelYDimension),
|
||||||
SensingMethod: vipsExifIntTag(image, SensingMethod),
|
SensingMethod: vipsExifIntTag(image, SensingMethod),
|
||||||
SceneType: vipsExifStringTag(image, SceneType),
|
SceneType: vipsExifStringTag(image, SceneType),
|
||||||
ExposureMode: vipsExifIntTag(image, ExposureMode),
|
ExposureMode: vipsExifIntTag(image, ExposureMode),
|
||||||
WhiteBalance: vipsExifIntTag(image, WhiteBalance),
|
WhiteBalance: vipsExifIntTag(image, WhiteBalance),
|
||||||
FocalLengthIn35mmFilm: vipsExifIntTag(image, FocalLengthIn35mmFilm),
|
FocalLengthIn35mmFilm: vipsExifIntTag(image, FocalLengthIn35mmFilm),
|
||||||
SceneCaptureType: vipsExifIntTag(image, SceneCaptureType),
|
SceneCaptureType: vipsExifIntTag(image, SceneCaptureType),
|
||||||
GPSLatitudeRef: vipsExifStringTag(image, GPSLatitudeRef),
|
GPSLatitudeRef: vipsExifStringTag(image, GPSLatitudeRef),
|
||||||
GPSLatitude: vipsExifStringTag(image, GPSLatitude),
|
GPSLatitude: vipsExifStringTag(image, GPSLatitude),
|
||||||
GPSLongitudeRef: vipsExifStringTag(image, GPSLongitudeRef),
|
GPSLongitudeRef: vipsExifStringTag(image, GPSLongitudeRef),
|
||||||
GPSLongitude: vipsExifStringTag(image, GPSLongitude),
|
GPSLongitude: vipsExifStringTag(image, GPSLongitude),
|
||||||
GPSAltitudeRef: vipsExifStringTag(image, GPSAltitudeRef),
|
GPSAltitudeRef: vipsExifStringTag(image, GPSAltitudeRef),
|
||||||
GPSAltitude: vipsExifStringTag(image, GPSAltitude),
|
GPSAltitude: vipsExifStringTag(image, GPSAltitude),
|
||||||
GPSSpeedRef: vipsExifStringTag(image, GPSSpeedRef),
|
GPSSpeedRef: vipsExifStringTag(image, GPSSpeedRef),
|
||||||
GPSSpeed: vipsExifStringTag(image, GPSSpeed),
|
GPSSpeed: vipsExifStringTag(image, GPSSpeed),
|
||||||
GPSImgDirectionRef: vipsExifStringTag(image, GPSImgDirectionRef),
|
GPSImgDirectionRef: vipsExifStringTag(image, GPSImgDirectionRef),
|
||||||
GPSImgDirection: vipsExifStringTag(image, GPSImgDirection),
|
GPSImgDirection: vipsExifStringTag(image, GPSImgDirection),
|
||||||
GPSDestBearingRef: vipsExifStringTag(image, GPSDestBearingRef),
|
GPSDestBearingRef: vipsExifStringTag(image, GPSDestBearingRef),
|
||||||
GPSDestBearing: vipsExifStringTag(image, GPSDestBearing),
|
GPSDestBearing: vipsExifStringTag(image, GPSDestBearing),
|
||||||
GPSDateStamp: vipsExifStringTag(image, GPSDateStamp),
|
GPSDateStamp: vipsExifStringTag(image, GPSDateStamp),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
216
metadata_test.go
216
metadata_test.go
|
|
@ -95,125 +95,125 @@ func TestEXIF(t *testing.T) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
files := map[string]EXIF {
|
files := map[string]EXIF{
|
||||||
"test.jpg": {},
|
"test.jpg": {},
|
||||||
"exif/Landscape_1.jpg": {
|
"exif/Landscape_1.jpg": {
|
||||||
Orientation: 1,
|
Orientation: 1,
|
||||||
XResolution: "72/1",
|
XResolution: "72/1",
|
||||||
YResolution: "72/1",
|
YResolution: "72/1",
|
||||||
ResolutionUnit: 2,
|
ResolutionUnit: 2,
|
||||||
YCbCrPositioning: 1,
|
YCbCrPositioning: 1,
|
||||||
ExifVersion: "Exif Version 2.1",
|
ExifVersion: "Exif Version 2.1",
|
||||||
ColorSpace: 65535,
|
ColorSpace: 65535,
|
||||||
},
|
},
|
||||||
"test_exif.jpg": {
|
"test_exif.jpg": {
|
||||||
Make: "Jolla",
|
Make: "Jolla",
|
||||||
Model: "Jolla",
|
Model: "Jolla",
|
||||||
XResolution: "72/1",
|
XResolution: "72/1",
|
||||||
YResolution: "72/1",
|
YResolution: "72/1",
|
||||||
ResolutionUnit: 2,
|
ResolutionUnit: 2,
|
||||||
Orientation: 1,
|
Orientation: 1,
|
||||||
Datetime: "2014:09:21 16:00:56",
|
Datetime: "2014:09:21 16:00:56",
|
||||||
ExposureTime: "1/25",
|
ExposureTime: "1/25",
|
||||||
FNumber: "12/5",
|
FNumber: "12/5",
|
||||||
ISOSpeedRatings: 320,
|
ISOSpeedRatings: 320,
|
||||||
ExifVersion: "Exif Version 2.3",
|
ExifVersion: "Exif Version 2.3",
|
||||||
DateTimeOriginal: "2014:09:21 16:00:56",
|
DateTimeOriginal: "2014:09:21 16:00:56",
|
||||||
ShutterSpeedValue: "205447286/44240665",
|
ShutterSpeedValue: "205447286/44240665",
|
||||||
ApertureValue: "334328577/132351334",
|
ApertureValue: "334328577/132351334",
|
||||||
ExposureBiasValue: "0/1",
|
ExposureBiasValue: "0/1",
|
||||||
MeteringMode: 1,
|
MeteringMode: 1,
|
||||||
Flash: 0,
|
Flash: 0,
|
||||||
FocalLength: "4/1",
|
FocalLength: "4/1",
|
||||||
WhiteBalance: 1,
|
WhiteBalance: 1,
|
||||||
ColorSpace: 65535,
|
ColorSpace: 65535,
|
||||||
},
|
},
|
||||||
"test_exif_canon.jpg": {
|
"test_exif_canon.jpg": {
|
||||||
Make: "Canon",
|
Make: "Canon",
|
||||||
Model: "Canon EOS 40D",
|
Model: "Canon EOS 40D",
|
||||||
Orientation: 1,
|
Orientation: 1,
|
||||||
XResolution: "72/1",
|
XResolution: "72/1",
|
||||||
YResolution: "72/1",
|
YResolution: "72/1",
|
||||||
ResolutionUnit: 2,
|
ResolutionUnit: 2,
|
||||||
Software: "GIMP 2.4.5",
|
Software: "GIMP 2.4.5",
|
||||||
Datetime: "2008:07:31 10:38:11",
|
Datetime: "2008:07:31 10:38:11",
|
||||||
YCbCrPositioning: 2,
|
YCbCrPositioning: 2,
|
||||||
Compression: 6,
|
Compression: 6,
|
||||||
ExposureTime: "1/160",
|
ExposureTime: "1/160",
|
||||||
FNumber: "71/10",
|
FNumber: "71/10",
|
||||||
ExposureProgram: 1,
|
ExposureProgram: 1,
|
||||||
ISOSpeedRatings: 100,
|
ISOSpeedRatings: 100,
|
||||||
ExifVersion: "Exif Version 2.21",
|
ExifVersion: "Exif Version 2.21",
|
||||||
DateTimeOriginal: "2008:05:30 15:56:01",
|
DateTimeOriginal: "2008:05:30 15:56:01",
|
||||||
DateTimeDigitized: "2008:05:30 15:56:01",
|
DateTimeDigitized: "2008:05:30 15:56:01",
|
||||||
ComponentsConfiguration: "Y Cb Cr -",
|
ComponentsConfiguration: "Y Cb Cr -",
|
||||||
ShutterSpeedValue: "483328/65536",
|
ShutterSpeedValue: "483328/65536",
|
||||||
ApertureValue: "368640/65536",
|
ApertureValue: "368640/65536",
|
||||||
ExposureBiasValue: "0/1",
|
ExposureBiasValue: "0/1",
|
||||||
MeteringMode: 5,
|
MeteringMode: 5,
|
||||||
Flash: 9,
|
Flash: 9,
|
||||||
FocalLength: "135/1",
|
FocalLength: "135/1",
|
||||||
SubSecTimeOriginal: "00",
|
SubSecTimeOriginal: "00",
|
||||||
SubSecTimeDigitized: "00",
|
SubSecTimeDigitized: "00",
|
||||||
ColorSpace: 1,
|
ColorSpace: 1,
|
||||||
PixelXDimension: 100,
|
PixelXDimension: 100,
|
||||||
PixelYDimension: 68,
|
PixelYDimension: 68,
|
||||||
ExposureMode: 1,
|
ExposureMode: 1,
|
||||||
WhiteBalance: 0,
|
WhiteBalance: 0,
|
||||||
SceneCaptureType: 0,
|
SceneCaptureType: 0,
|
||||||
},
|
},
|
||||||
"test_exif_full.jpg": {
|
"test_exif_full.jpg": {
|
||||||
Make: "Apple",
|
Make: "Apple",
|
||||||
Model: "iPhone XS",
|
Model: "iPhone XS",
|
||||||
Orientation: 6,
|
Orientation: 6,
|
||||||
XResolution: "72/1",
|
XResolution: "72/1",
|
||||||
YResolution: "72/1",
|
YResolution: "72/1",
|
||||||
ResolutionUnit: 2,
|
ResolutionUnit: 2,
|
||||||
Software: "13.3.1",
|
Software: "13.3.1",
|
||||||
Datetime: "2020:07:28 19:18:49",
|
Datetime: "2020:07:28 19:18:49",
|
||||||
YCbCrPositioning: 1,
|
YCbCrPositioning: 1,
|
||||||
Compression: 6,
|
Compression: 6,
|
||||||
ExposureTime: "1/835",
|
ExposureTime: "1/835",
|
||||||
FNumber: "9/5",
|
FNumber: "9/5",
|
||||||
ExposureProgram: 2,
|
ExposureProgram: 2,
|
||||||
ISOSpeedRatings: 25,
|
ISOSpeedRatings: 25,
|
||||||
ExifVersion: "Unknown Exif Version",
|
ExifVersion: "Unknown Exif Version",
|
||||||
DateTimeOriginal: "2020:07:28 19:18:49",
|
DateTimeOriginal: "2020:07:28 19:18:49",
|
||||||
DateTimeDigitized: "2020:07:28 19:18:49",
|
DateTimeDigitized: "2020:07:28 19:18:49",
|
||||||
ComponentsConfiguration: "Y Cb Cr -",
|
ComponentsConfiguration: "Y Cb Cr -",
|
||||||
ShutterSpeedValue: "77515/7986",
|
ShutterSpeedValue: "77515/7986",
|
||||||
ApertureValue: "54823/32325",
|
ApertureValue: "54823/32325",
|
||||||
BrightnessValue: "77160/8623",
|
BrightnessValue: "77160/8623",
|
||||||
ExposureBiasValue: "0/1",
|
ExposureBiasValue: "0/1",
|
||||||
MeteringMode: 5,
|
MeteringMode: 5,
|
||||||
Flash: 16,
|
Flash: 16,
|
||||||
FocalLength: "17/4",
|
FocalLength: "17/4",
|
||||||
SubjectArea: "2013 1511 2217 1330",
|
SubjectArea: "2013 1511 2217 1330",
|
||||||
MakerNote: "1110 bytes undefined data",
|
MakerNote: "1110 bytes undefined data",
|
||||||
SubSecTimeOriginal: "777",
|
SubSecTimeOriginal: "777",
|
||||||
SubSecTimeDigitized: "777",
|
SubSecTimeDigitized: "777",
|
||||||
ColorSpace: 65535,
|
ColorSpace: 65535,
|
||||||
PixelXDimension: 4032,
|
PixelXDimension: 4032,
|
||||||
PixelYDimension: 3024,
|
PixelYDimension: 3024,
|
||||||
SensingMethod: 2,
|
SensingMethod: 2,
|
||||||
SceneType: "Directly photographed",
|
SceneType: "Directly photographed",
|
||||||
ExposureMode: 0,
|
ExposureMode: 0,
|
||||||
WhiteBalance: 0,
|
WhiteBalance: 0,
|
||||||
FocalLengthIn35mmFilm: 26,
|
FocalLengthIn35mmFilm: 26,
|
||||||
SceneCaptureType: 0,
|
SceneCaptureType: 0,
|
||||||
GPSLatitudeRef: "N",
|
GPSLatitudeRef: "N",
|
||||||
GPSLatitude: "55/1 43/1 5287/100",
|
GPSLatitude: "55/1 43/1 5287/100",
|
||||||
GPSLongitudeRef: "E",
|
GPSLongitudeRef: "E",
|
||||||
GPSLongitude: "37/1 35/1 5571/100",
|
GPSLongitude: "37/1 35/1 5571/100",
|
||||||
GPSAltitudeRef: "Sea level",
|
GPSAltitudeRef: "Sea level",
|
||||||
GPSAltitude: "90514/693",
|
GPSAltitude: "90514/693",
|
||||||
GPSSpeedRef: "K",
|
GPSSpeedRef: "K",
|
||||||
GPSSpeed: "114272/41081",
|
GPSSpeed: "114272/41081",
|
||||||
GPSImgDirectionRef: "M",
|
GPSImgDirectionRef: "M",
|
||||||
GPSImgDirection: "192127/921",
|
GPSImgDirection: "192127/921",
|
||||||
GPSDestBearingRef: "M",
|
GPSDestBearingRef: "M",
|
||||||
GPSDestBearing: "192127/921",
|
GPSDestBearing: "192127/921",
|
||||||
GPSDateStamp: "2020:07:28",
|
GPSDateStamp: "2020:07:28",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,11 @@ type Angle int
|
||||||
const (
|
const (
|
||||||
// D0 represents the rotation angle 0 degrees.
|
// D0 represents the rotation angle 0 degrees.
|
||||||
D0 Angle = 0
|
D0 Angle = 0
|
||||||
// D45 represents the rotation angle 90 degrees.
|
// D45 represents the rotation angle 45 degrees.
|
||||||
D45 Angle = 45
|
D45 Angle = 45
|
||||||
// D90 represents the rotation angle 90 degrees.
|
// D90 represents the rotation angle 90 degrees.
|
||||||
D90 Angle = 90
|
D90 Angle = 90
|
||||||
// D135 represents the rotation angle 90 degrees.
|
// D135 represents the rotation angle 135 degrees.
|
||||||
D135 Angle = 135
|
D135 Angle = 135
|
||||||
// D180 represents the rotation angle 180 degrees.
|
// D180 represents the rotation angle 180 degrees.
|
||||||
D180 Angle = 180
|
D180 Angle = 180
|
||||||
|
|
@ -74,7 +74,7 @@ const (
|
||||||
D235 Angle = 235
|
D235 Angle = 235
|
||||||
// D270 represents the rotation angle 270 degrees.
|
// D270 represents the rotation angle 270 degrees.
|
||||||
D270 Angle = 270
|
D270 Angle = 270
|
||||||
// D315 represents the rotation angle 180 degrees.
|
// D315 represents the rotation angle 315 degrees.
|
||||||
D315 Angle = 315
|
D315 Angle = 315
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ type Options struct {
|
||||||
InputICC string
|
InputICC string
|
||||||
Palette bool
|
Palette bool
|
||||||
// Speed defines the AVIF encoders CPU effort. Valid values are 0-8.
|
// Speed defines the AVIF encoders CPU effort. Valid values are 0-8.
|
||||||
Speed int
|
Speed int
|
||||||
|
|
||||||
// private fields
|
// private fields
|
||||||
autoRotateOnly bool
|
autoRotateOnly bool
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,8 @@ func TestVipsAutoRotate(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
files := []struct {
|
files := []struct {
|
||||||
name string
|
name string
|
||||||
orientation int
|
orientation int
|
||||||
}{
|
}{
|
||||||
{"test.jpg", 0},
|
{"test.jpg", 0},
|
||||||
{"test_exif.jpg", 0},
|
{"test_exif.jpg", 0},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue