mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-17 19:26:35 -07:00
refactor: bindings
This commit is contained in:
parent
d6f8ad617b
commit
206a1efc66
6 changed files with 129 additions and 47 deletions
22
metadata.go
22
metadata.go
|
|
@ -6,8 +6,6 @@ package bimg
|
|||
*/
|
||||
import "C"
|
||||
|
||||
import ()
|
||||
|
||||
type ImageSize struct {
|
||||
Width int
|
||||
Height int
|
||||
|
|
@ -16,9 +14,10 @@ type ImageSize struct {
|
|||
type ImageMetadata struct {
|
||||
Orientation int
|
||||
Alpha bool
|
||||
Channels int
|
||||
Profile bool
|
||||
Space int
|
||||
Type string
|
||||
Space string
|
||||
Size ImageSize
|
||||
}
|
||||
|
||||
|
|
@ -43,12 +42,19 @@ func Metadata(buf []byte) (ImageMetadata, error) {
|
|||
}
|
||||
defer C.g_object_unref(C.gpointer(image))
|
||||
|
||||
size := ImageSize{
|
||||
Width: int(image.Xsize),
|
||||
Height: int(image.Ysize),
|
||||
}
|
||||
|
||||
metadata := ImageMetadata{
|
||||
Type: getImageTypeName(imageType),
|
||||
Size: ImageSize{
|
||||
Width: int(image.Xsize),
|
||||
Height: int(image.Ysize),
|
||||
},
|
||||
Orientation: vipsExifOrientation(image),
|
||||
Alpha: vipsHasAlpha(image),
|
||||
Profile: vipsHasProfile(image),
|
||||
Space: vipsSpace(image),
|
||||
Channels: vipsImageBands(image),
|
||||
Type: getImageTypeName(imageType),
|
||||
Size: size,
|
||||
}
|
||||
|
||||
return metadata, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue