[plt-scheme] programmatically saving 2htdp/image images? (quasi-patch included)

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Feb 6 14:09:51 EST 2010

let's add it 

On Feb 6, 2010, at 2:07 PM, John Clements wrote:

> The 2htdp/image library is awesome. I'd like to use it to generate web page images for test case success/failure, e.g.: 
> <Screen shot 2010-02-06 at 10.41.43 AM.png>
> However, I couldn't figure out how to save these things as files without using a right-click.
> I wrote this function:
> (define (image->file/png image filename)
>  (let* ([bitmap (make-object bitmap% (image-width image) (image-height image))]
>         [dc (new bitmap-dc% [bitmap bitmap])])
>    (render-image image dc 0 0)
>    (send bitmap save-file filename 'png)))
> ...and it appears to work. It appears to me that this might be useful to add something like this to mrlib/image-core, if it's not already there.  Perhaps I just overlooked it?
> John
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.