[racket] [plt-scheme] 2htdp/image questions
In preparing my textbook, I ran into a really good application for map-image (which I still haven't got working :-()
The publisher says it'll cost two or three times as much to produce the book in color than in B&W, so in order to make the book affordable, I plan to do all the pictures in the book in grayscale, with colored versions on the Web site. So I started converting (bitmap) images to grayscale. Unfortunately, grayscale is normally 8-bit, with no room for an alpha channel, so all the images that had transparent backgrounds lost them. In theory, one could create a 32-bit image with an alpha channel, all of whose colors happen to be grays, and in fact I found some Java code on the Web to do that... but it would be so much more convenient if I could just write a Racket function that takes in an image and spits out the same image with new.r=new.g=new.b=average(old.r,old.g,old.b) for each pixel, preserving the alpha channel. In fact, this would be an easy student exercise, if I had the "map-image" function (or an analogous "map-alpha-image" function) working.
Anyway, back to the textbook.
Stephen Bloch
sbloch at adelphi.edu