mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-17 19:26:35 -07:00
refactor(vips): check image type
This commit is contained in:
parent
da8c9707c9
commit
125806e589
2 changed files with 6 additions and 7 deletions
7
vips.go
7
vips.go
|
|
@ -60,8 +60,13 @@ func vipsFlip(image *C.struct__VipsImage, direction Direction) (*C.struct__VipsI
|
||||||
|
|
||||||
func vipsRead(buf []byte) (*C.struct__VipsImage, error) {
|
func vipsRead(buf []byte) (*C.struct__VipsImage, error) {
|
||||||
var image *C.struct__VipsImage
|
var image *C.struct__VipsImage
|
||||||
|
imageType := vipsImageType(buf)
|
||||||
|
|
||||||
debug("Format: %s", vipsImageType(buf))
|
debug("Image format: %s", imageType)
|
||||||
|
|
||||||
|
if imageType == UNKNOWN {
|
||||||
|
return nil, errors.New("Input buffer contains unsupported image format")
|
||||||
|
}
|
||||||
|
|
||||||
// feed it
|
// feed it
|
||||||
length := C.size_t(len(buf))
|
length := C.size_t(len(buf))
|
||||||
|
|
|
||||||
6
vips.h
6
vips.h
|
|
@ -2,12 +2,6 @@
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
#include <vips/vips7compat.h>
|
#include <vips/vips7compat.h>
|
||||||
|
|
||||||
int
|
|
||||||
vips_initialize()
|
|
||||||
{
|
|
||||||
return vips_init("bimg");
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
int
|
||||||
vips_affine_interpolator(VipsImage *in, VipsImage **out, double a, double b, double c, double d, VipsInterpolate *interpolator)
|
vips_affine_interpolator(VipsImage *in, VipsImage **out, double a, double b, double c, double d, VipsInterpolate *interpolator)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue