From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=AWL,HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id BB776BC69 for ; Wed, 17 Oct 2007 01:00:52 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAE/eFEdA6ba9lGdsb2JhbACCcotcAQEBAQcEBAsIEQU X-IronPort-AV: E=Sophos;i="4.21,284,1188770400"; d="scan'208";a="18109132" Received: from nf-out-0910.google.com ([64.233.182.189]) by mail4-smtp-sop.national.inria.fr with ESMTP; 17 Oct 2007 01:00:52 +0200 Received: by nf-out-0910.google.com with SMTP id e27so1585939nfd for ; Tue, 16 Oct 2007 16:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=ybHxZNnexqB3D4BHFuWOk60mNNW5XnxJTkb/kkQvqUs=; b=I956qSav596N5s2CudGoR6nW3Y97/EOZbCIUwBs1tl1Vpnp0Piswt4cODHI7byi5vX7LUKWyH1Rtq88Mv52jwZHGFUyiDGnSsbTW5ADIW94cDNhaGE5ngTpsL3vOZlLjq3ugYfUrmS0OO1hesVbEBV7Wq+ruzGYdvUH5J253jDs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=LH40rUWgaSVl+v4MezXzhTsD3PcAzZl7XmF4wr9C8YBHnWb2jJEqSXImiPuyI8GRexTGd5lnKbiV7EGzOrY1pHX4w79DLxdQC4K/X1cIedLSfslWC1a45nWs1ioPOc92vTOS11vJkehNvbzN3Ib/ASQDqLXwyZ1XmKYj1tlh8dM= Received: by 10.82.171.16 with SMTP id t16mr14200825bue.1192575651116; Tue, 16 Oct 2007 16:00:51 -0700 (PDT) Received: by 10.82.120.16 with HTTP; Tue, 16 Oct 2007 16:00:51 -0700 (PDT) Message-ID: Date: Tue, 16 Oct 2007 19:00:51 -0400 From: "Orlin Grigorov" To: "Jacques Garrigue" Subject: Re: [Caml-list] saving/loading Raw to/from file Cc: caml-list@yquem.inria.fr In-Reply-To: <20071016.062840.255394361.garrigue@math.nagoya-u.ac.jp> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_47851_29455497.1192575651115" References: <20071016.062840.255394361.garrigue@math.nagoya-u.ac.jp> X-Spam: no; 0.00; glpix:01 byte:01 glpix:01 byte:01 height:98 height:98 wrote:01 wrote:01 caml-list:01 width:97 width:97 len:02 len:02 string:02 string:02 ------=_Part_47851_29455497.1192575651115 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline The last worked like a charm! Thanks a lot to all of you for the great help!!!! Orlin On 10/15/07, Jacques Garrigue wrote: > > From: "Orlin Grigorov" > > > 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 > ------=_Part_47851_29455497.1192575651115 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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

------=_Part_47851_29455497.1192575651115--