ocaml-imagelib
ocaml-imagelib copied to clipboard
BMP: support RLE decompression (8bit/4bit)
The compression methods seem to be documented at least somewhat here:
-
1
/ 8-bit: http://www.fileformat.info/format/bmp/corion-rle8.htm -
2
/ 4-bit: http://www.fileformat.info/format/bmp/corion-rle8.htm
I see imagemagick
using these compression methods, so maybe it would make sense to implement them if someone feels like it on a rainy day. :)
@@ -249,8 +251,10 @@ module BitmapMetaData = struct
let compression_method_of_int n =
match n with
| 0 -> Ok RGB
+ | 1 -> Ok RLE_8bit
+ | 2 -> Ok RLE_4bit
| 3 -> Ok Bitfields
- | _ -> Error (`Bmp_error "Invalid compression method")
+ | u -> Error (`Bmp_error (Printf.sprintf "Invalid compression method %#x" u))