From 2e72fc0243d3e5f3f89d3e5495de618a2b6c05fc Mon Sep 17 00:00:00 2001 From: Paul van Santen Date: Tue, 24 Dec 2019 10:41:21 +0100 Subject: [PATCH] Add support for other HEIF mimetype --- type_test.go | 1 + vips.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/type_test.go b/type_test.go index b62b818..f3ee219 100644 --- a/type_test.go +++ b/type_test.go @@ -20,6 +20,7 @@ func TestDeterminateImageType(t *testing.T) { {"test.svg", SVG}, {"test.jp2", MAGICK}, {"test.heic", HEIF}, + {"test2.heic", HEIF}, } for _, file := range files { diff --git a/vips.go b/vips.go index 0d93a60..afe4519 100644 --- a/vips.go +++ b/vips.go @@ -646,6 +646,12 @@ func vipsImageType(buf []byte) ImageType { // https://github.com/strukturag/libheif/issues/83#issuecomment-421427091 if IsTypeSupported(HEIF) && buf[4] == 0x66 && buf[5] == 0x74 && buf[6] == 0x79 && buf[7] == 0x70 && buf[8] == 0x68 && buf[9] == 0x65 && buf[10] == 0x69 && buf[11] == 0x63 { + // This is a HEIC file + return HEIF + } + if IsTypeSupported(HEIF) && buf[4] == 0x66 && buf[5] == 0x74 && buf[6] == 0x79 && buf[7] == 0x70 && + buf[8] == 0x6d && buf[9] == 0x69 && buf[10] == 0x66 && buf[11] == 0x31 { + // This is a HEIF file return HEIF }