mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
Adding support for heif (i.e. heic files).
This commit is contained in:
parent
5a9d7f21d9
commit
f9eadf55bb
6 changed files with 58 additions and 3 deletions
|
|
@ -19,6 +19,7 @@ func TestDeterminateImageType(t *testing.T) {
|
|||
{"test.pdf", PDF},
|
||||
{"test.svg", SVG},
|
||||
{"test.jp2", MAGICK},
|
||||
{"test.heic", HEIF},
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
|
|
@ -46,6 +47,7 @@ func TestDeterminateImageTypeName(t *testing.T) {
|
|||
{"test.pdf", "pdf"},
|
||||
{"test.svg", "svg"},
|
||||
{"test.jp2", "magick"},
|
||||
{"test.heic", "heif"},
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
|
|
@ -63,7 +65,7 @@ func TestIsTypeSupported(t *testing.T) {
|
|||
types := []struct {
|
||||
name ImageType
|
||||
}{
|
||||
{JPEG}, {PNG}, {WEBP}, {GIF}, {PDF},
|
||||
{JPEG}, {PNG}, {WEBP}, {GIF}, {PDF}, {HEIF},
|
||||
}
|
||||
|
||||
for _, n := range types {
|
||||
|
|
@ -83,6 +85,7 @@ func TestIsTypeNameSupported(t *testing.T) {
|
|||
{"webp", true},
|
||||
{"gif", true},
|
||||
{"pdf", true},
|
||||
{"heif", true},
|
||||
}
|
||||
|
||||
for _, n := range types {
|
||||
|
|
@ -101,6 +104,9 @@ func TestIsTypeSupportedSave(t *testing.T) {
|
|||
if VipsVersion >= "8.5.0" {
|
||||
types = append(types, struct{ name ImageType }{TIFF})
|
||||
}
|
||||
if VipsVersion >= "8.8.0" {
|
||||
types = append(types, struct{ name ImageType }{HEIF})
|
||||
}
|
||||
|
||||
for _, n := range types {
|
||||
if IsTypeSupportedSave(n.name) == false {
|
||||
|
|
@ -120,6 +126,7 @@ func TestIsTypeNameSupportedSave(t *testing.T) {
|
|||
{"gif", false},
|
||||
{"pdf", false},
|
||||
{"tiff", VipsVersion >= "8.5.0"},
|
||||
{"heif", VipsVersion >= "8.8.0"},
|
||||
}
|
||||
|
||||
for _, n := range types {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue