[racket] reading an image from a file?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Jun 29 17:28:43 EDT 2010

If you use File|Insert image... you end up getting an image-snip<%>
object. It is a wrapper around a bitmap% object that connects to our
editor classes. A bitmap% object is the raw bits plus a little bit of
information about it.

Probably you just want to use 2htdp/image's 'bitmap' function, tho.
(Or maybe htdp/image's).

Robby

On Tue, Jun 29, 2010 at 4:22 PM, Mitchell Wand <wand at ccs.neu.edu> wrote:
> Silly question: How can I read a file and treat its contents as an image?
> eg, I'd like to say something like:
>
> (define cat-image (read-image "cat-image.png"))
>
> The immediate advantage of doing this, rather than Insert|Image is that I
> can keep my .rkt file in text form, so I can use other tools on it.  And of
> course if I want to find an image dynamically I need something like this.
>
> I can't even see what datatype a value defined by Insert|Image is.
>
> --Mitch
>
>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.