mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-15 10:25:55 -07:00
add more exif data to metadata
This commit is contained in:
parent
9b82aecec1
commit
b38ffd41d1
6 changed files with 118 additions and 6 deletions
20
metadata.go
20
metadata.go
|
|
@ -22,6 +22,15 @@ type ImageMetadata struct {
|
|||
Space string
|
||||
Colourspace string
|
||||
Size ImageSize
|
||||
EXIF EXIF
|
||||
}
|
||||
|
||||
type EXIF struct {
|
||||
Make string
|
||||
Model string
|
||||
Orientation int
|
||||
Software string
|
||||
Datetime string
|
||||
}
|
||||
|
||||
// Size returns the image size by width and height pixels.
|
||||
|
|
@ -63,14 +72,23 @@ func Metadata(buf []byte) (ImageMetadata, error) {
|
|||
Height: int(image.Ysize),
|
||||
}
|
||||
|
||||
orientation := vipsExifOrientation(image)
|
||||
|
||||
metadata := ImageMetadata{
|
||||
Size: size,
|
||||
Channels: int(image.Bands),
|
||||
Orientation: vipsExifOrientation(image),
|
||||
Orientation: orientation,
|
||||
Alpha: vipsHasAlpha(image),
|
||||
Profile: vipsHasProfile(image),
|
||||
Space: vipsSpace(image),
|
||||
Type: ImageTypeName(imageType),
|
||||
EXIF: EXIF{
|
||||
Make: vipsExifMake(image),
|
||||
Model: vipsExifModel(image),
|
||||
Orientation: orientation,
|
||||
Software: vipsExifSoftware(image),
|
||||
Datetime: vipsExifDatetime(image),
|
||||
},
|
||||
}
|
||||
|
||||
return metadata, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue