]> git.imager.perl.org - imager.git/commitdiff
add probe support for FLIF files
authorTony Cook <tony@develop-help.com>
Fri, 23 Nov 2018 00:14:43 +0000 (11:14 +1100)
committerTony Cook <tony@develop-help.com>
Fri, 23 Nov 2018 00:14:43 +0000 (11:14 +1100)
(this doesn't add support for the file format, just detection of
the file's "magic number")

image.c
t/200-file/100-files.t

diff --git a/image.c b/image.c
index cbd1b38a0f3bfc2cb719cdfc0df611c2f53942da..3329003fdda11f951e5cc0d361a370f5a2d63e71 100644 (file)
--- a/image.c
+++ b/image.c
@@ -1716,6 +1716,9 @@ i_test_format_probe(io_glue *data, int length) {
     /* JPEG 2000 
        This might match a little loosely */
     FORMAT_ENTRY("\x00\x00\x00\x0CjP  \x0D\x0A\x87\x0A", "jp2"),
+
+    /* FLIF - Free Lossless Image Format - https://flif.info/spec.html */
+    FORMAT_ENTRY("FLIF", "flif")
   };
   static const struct magic_entry more_formats[] = {
     /* these were originally both listed as ico, but cur files can
index bc602f1c1cbd16610cc2712f3e7b2c02c9b6d48d..a4c66a444b18eda86915686b853b409ec55e6161 100644 (file)
@@ -4,7 +4,7 @@
 # the file format
 
 use strict;
-use Test::More tests => 93;
+use Test::More tests => 94;
 use Imager;
 
 -d "testout" or mkdir "testout";
@@ -287,6 +287,13 @@ probe_ok(<<JPEG2K, "jp2", "JPEG 2000");
 00 6A 70 32 63 FF 4F FF 51 00 2F 00 00 00 00 01
 JPEG2K
 
+probe_ok(<<FLIF, "flif", "FLIF");
+46 4C 49 46 44 31 83 7F 83 7F 00 A0 03 AF B0 B1
+E8 03 37 FF F7 D5 C2 D8 B7 D5 58 59 6E D9 71 8C
+0F A9 88 B4 1C B1 7F C0 2E FB 8C 7D 90 B6 04 DF
+CF 3A FF 56 5D FF 67 87 CE 9C 0E D6 69 CD 1F EF
+FLIF
+
 { # RT 72475
   # check error messages from read/read_multi
   my $data = "nothing useful";