8 if Array.length Sys.argv <= 1 then
9 failwith "usage: gif input.gif";
10 let filename = Sys.argv.(1) in
11 let bits = Bitstring.bitstring_of_file filename in
14 | { ("GIF87a"|"GIF89a") : 6*8 : string; (* GIF magic. *)
15 width : 16 : littleendian;
16 height : 16 : littleendian;
17 colormap : 1; (* Has colormap? *)
18 colorbits : 3; (* Color res = colorbits+1 *)
20 bps : 3; (* Bits/pixel = bps+1 *)
21 bg : 8; (* Background colour. *)
23 printf "%s: GIF image:\n" filename;
24 printf " size %d %d\n" width height;
25 printf " has global colormap? %b\n" colormap;
26 printf " colorbits %d\n" (colorbits+1);
27 printf " global colormap is sorted? %b\n" sortflag;
28 printf " bits/pixel %d\n" (bps+1);
29 printf " background color index %d\n" bg;
30 printf " aspect ratio %d\n" aspectratio
33 eprintf "%s: Not a GIF image\n" filename