[plt-scheme] image manipulation

From: Jerzy Karczmarczuk (karczma at info.unicaen.fr)
Date: Tue Mar 23 03:40:48 EST 2004

Robby Findler wrote:
  (response to a query about the image processing facilities in DrScheme)
> Yes. See bitmap% and bitmap-dc% in Help Desk.

First, I dont want to show myself as an acrimonious criticiser, I've been
using Scheme for teaching graphics for years, and I appreciate the helpful
attitude of Robby and all the Staff.

But I am reluctant to say that pixel-processing facilities are usable for
serious work, unless -

well, unless you are very optimistic. You can't access the pixels FAST,
you can't manipulate them in memory like 2D vectors, nothing. Getting and
setting pixels through -dc% is incredibly slow.

One would have to write an extension for the low-level access in order to
make all that usable. Something along the lines of PIL + Numpy for Python.
As for now, the individual pixel manipulation is not only slow, but also it
pollutes the memory, at least under Windows.

Perhaps it would be nice to have an image processing tools in Scheme. Together
with other graphical goodies it would be useful at least for pedagogic reasons.
But as it is now, even making a colour triangle by symplectic interpolation of
pixels takes several dozens seconds (or more...)


Günther Schmidt asks about scaling, and Robby reminds the existence of set-scale
in the dc<%> interface.
I always thought that this is just a *mapping* logical->physical, not an image
manipulation contraption. Of course, it is possible then to construct a new
bitmap, scaled. But it doesn't change the pixels !
Under Windows, at least, it just changes the global dimensions of the bitmap
canvas. The scale factor must be exact, which is also cumbersome, but OK, it
doesn't matter.

Anyway, for serious work it is rather difficult to imagine how to do, say,
bicubic interpolation, or prefiltering before shrinking a picture...

Best regards

Jerzy Karczmarczuk
Caen, France

Posted on the users mailing list.