From 08f64c4145fa6c10d2831e489d2c6ddb07f4f96e Mon Sep 17 00:00:00 2001 From: Laurentiu Ilie Date: Thu, 23 Jul 2020 16:27:41 +0200 Subject: [PATCH] remove test file and add the check --- type_test.go | 1 - vips.go | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/type_test.go b/type_test.go index 83fee7b..f3ee219 100644 --- a/type_test.go +++ b/type_test.go @@ -21,7 +21,6 @@ func TestDeterminateImageType(t *testing.T) { {"test.jp2", MAGICK}, {"test.heic", HEIF}, {"test2.heic", HEIF}, - {"C001.heic", HEIF}, } for _, file := range files { diff --git a/vips.go b/vips.go index 6a77570..8c55f62 100644 --- a/vips.go +++ b/vips.go @@ -654,6 +654,11 @@ func vipsImageType(buf []byte) ImageType { // This is a HEIF file return HEIF } + if IsTypeSupported(HEIF) && buf[4] == 0x66 && buf[5] == 0x74 && buf[6] == 0x79 && buf[7] == 0x70 && + buf[8] == 0x6d && buf[9] == 0x73 && buf[10] == 0x66 && buf[11] == 0x31 { + // This is a HEIFS file + return HEIF + } return UNKNOWN } @@ -733,4 +738,4 @@ func vipsGamma(image *C.VipsImage, Gamma float64) (*C.VipsImage, error) { return nil, catchVipsError() } return out, nil -} \ No newline at end of file +}