Hi.  Lately I've been actively seeking help from this message-list, and to be honest, thanks to your advice and suggestions, my work is going really fast!   I am extremely grateful, thank you all!

So, I've been struggling with something since yesterday:

I am doing something in OCaml, which uses the Lablgl module to draw stuff in OpenGL.   For some of the things, I have textures (that is, for all the text I do, I pass it through LaTeX to make a PS, then I use ImageMagick's convert to make it as an JPEG, after which I read it in with CamlImages module, and do some transformations on it before finally making an OpenGL texture out of it).

The problem is that this is a real slow-down for the start-up of my program.  I don't want to give-up LaTeX, because I need to display some equations and stuff, but here's the deal.   A huge part of the chunks of text I use are repeating with each program start-up.   So, I was thinking to pre-generate the most common ones, and instead of following the lengthy process of going through LaTeX etc, to just load them from binary files.    Maybe a little code will make it clearer:

let work_image img =
  let w = img#width and h = img#height in
  let image = GlPix.create `ubyte ~format:`rgba ~width:w ~height:h in
  for i = 0 to h - 1 do
    for j = 0 to w - 1 do
      let pixel = img#get (w-j-1) i in
      let red = pixel.r in
      let green = pixel.g in
      let blue = pixel.b in
      let alpha = if (red == 255 && green == 255 && blue == 255) then 0 else 255 in
      Raw.sets (GlPix.to_raw image) ~pos:(4*(i*w+j))  [| red; green; blue; alpha |]
    done
  done;
  image
;;

With "GlPix.to_raw image" I can make the it raw, if that will help.  

The question is, I really need a way to save this "image" in a file, and be able to recreate it.

Please help! 

Thanks,

Orlin