I want to read a bitmap file (from the file system) using OCAML and store the pixels (the colors) inside an array which have th dimension of the bitmap, each pixel will take
I don't know of an out-of-the box way to do it. You could open the file with open_in
and read it byte at a time with input_char
, suck in the header and the data and build up the color array array
that way for simple formats (e.g. BMPs) but for anything like JPGs or PNGs a roll your-own solution would probably be more work than you want to get into.