The last worked like a charm!   Thanks a lot to all of you for the great help!!!!

Orlin

On 10/15/07, Jacques Garrigue < garrigue@math.nagoya-u.ac.jp> wrote:
From: "Orlin Grigorov" < ogrigorov@gmail.com>

> 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.

Once it is raw, you can read it with
   Raw.gets_string raw ~pos:0 ~len:(Raw.byte_size raw)

You can read it back in the same way:
   let raw = Raw.create `ubyte ~len:(w*h*4) in
   Raw.sets_string raw ~pos:0 ~len:(w*h*4) s;
   GlPix.of_raw raw ~format:`rgba ~width:w ~height:h

This should be efficient enough.
Once you get a string, you know how to do the I/O.

Jacques Garrigue