diff --git a/vips.c b/vips.c index f34930bc..1e5f41f6 100644 --- a/vips.c +++ b/vips.c @@ -157,7 +157,7 @@ vips_svgload_go(void *buf, size_t len, double scale, VipsImage **out) { int vips_heifload_go(void *buf, size_t len, VipsImage **out) { #if VIPS_SUPPORT_HEIF - return vips_heifload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, "autorotate", 1, NULL); + return vips_heifload_buffer(buf, len, out, "access", VIPS_ACCESS_SEQUENTIAL, NULL); #else vips_error("vips_heifload_go", "Loading HEIF is not supported"); return 1; @@ -165,13 +165,20 @@ vips_heifload_go(void *buf, size_t len, VipsImage **out) { } int -vips_get_exif_orientation(VipsImage *image) { +vips_get_orientation(VipsImage *image) { +#ifdef VIPS_META_ORIENTATION + int orientation; + + if (vips_image_get_int(image, VIPS_META_ORIENTATION, &orientation) == 0) + return orientation; +#else const char *orientation; if ( vips_image_get_typeof(image, EXIF_ORIENTATION) == VIPS_TYPE_REF_STRING && vips_image_get_string(image, EXIF_ORIENTATION, &orientation) == 0 ) return atoi(orientation); +#endif return 1; } diff --git a/vips.go b/vips.go index 06d45223..d7e1a1bf 100644 --- a/vips.go +++ b/vips.go @@ -337,7 +337,7 @@ func (img *vipsImage) Resize(scale float64, hasAlpa bool) error { } func (img *vipsImage) Orientation() C.int { - return C.vips_get_exif_orientation(img.VipsImage) + return C.vips_get_orientation(img.VipsImage) } func (img *vipsImage) Rotate(angle int) error { diff --git a/vips.h b/vips.h index 0638c190..4528e2d3 100644 --- a/vips.h +++ b/vips.h @@ -32,7 +32,7 @@ int vips_gifload_go(void *buf, size_t len, int pages, VipsImage **out); int vips_svgload_go(void *buf, size_t len, double scale, VipsImage **out); int vips_heifload_go(void *buf, size_t len, VipsImage **out); -int vips_get_exif_orientation(VipsImage *image); +int vips_get_orientation(VipsImage *image); void vips_strip_meta(VipsImage *image); int vips_support_smartcrop();