refactor(#47): minor refactors, code normalization and test coverage

This commit is contained in:
Tomas Aparicio 2015-07-11 16:50:25 +01:00
parent 6edd96ee41
commit ed4faadba6
10 changed files with 309 additions and 92 deletions

View file

@ -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()