Skip to content

Commit

Permalink
Merge pull request kumparan#2 from laurentiuilie/add-support-for-heif…
Browse files Browse the repository at this point in the history
…s-file

Add support for heifs file
  • Loading branch information
vansante authored Jul 27, 2020
2 parents 9b82aec + de597a0 commit 5a00c1a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Binary file added testdata/test3.heic
Binary file not shown.
1 change: 1 addition & 0 deletions type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func TestDeterminateImageType(t *testing.T) {
// {"test.jp2", MAGICK},
{"test.heic", HEIF},
{"test2.heic", HEIF},
{"test3.heic", HEIF},
}

for _, file := range files {
Expand Down
5 changes: 5 additions & 0 deletions vips.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,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
}
Expand Down

0 comments on commit 5a00c1a

Please sign in to comment.