mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-08 23:18:19 -07:00
refactor(#47): minor refactors, code normalization and test coverage
This commit is contained in:
parent
6edd96ee41
commit
ed4faadba6
10 changed files with 309 additions and 92 deletions
12
metadata.go
12
metadata.go
|
|
@ -18,6 +18,7 @@ type ImageMetadata struct {
|
|||
Profile bool
|
||||
Type string
|
||||
Space string
|
||||
Colourspace string
|
||||
Size ImageSize
|
||||
}
|
||||
|
||||
|
|
@ -34,6 +35,17 @@ func Size(buf []byte) (ImageSize, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// Check in the image colourspace is supported by libvips
|
||||
func ColourspaceIsSupported(buf []byte) (bool, error) {
|
||||
return vipsColourspaceIsSupportedBuffer(buf)
|
||||
}
|
||||
|
||||
// Get the image interpretation type
|
||||
// See: http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/VipsImage.html#VipsInterpretation
|
||||
func ImageInterpretation(buf []byte) (Interpretation, error) {
|
||||
return vipsInterpretationBuffer(buf)
|
||||
}
|
||||
|
||||
// Extract the image metadata (size, type, alpha channel, profile, EXIF orientation...)
|
||||
func Metadata(buf []byte) (ImageMetadata, error) {
|
||||
defer C.vips_thread_shutdown()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue