Image-manipulation functions

The image teachpack

Some of the image functions we use in class are defined in the image teachpack (which comes standard with DrScheme); they are only available if you have that teachpack loaded. The easiest way to answer a question about these functions is to use DrScheme's "Help Desk", so I won't repeat their full descriptions here: type "image.ss" into the search field of DrScheme's help desk.

The ones you're most likely to use are

Wherever a function takes in a "mode", you may use either a symbol or a string, i.e. any of 'solid, 'outline, "solid", or "outline".

The tiles teachpack

Other image functions are defined in the tiles teachpack, which doesn't come standard with DrScheme but which you can install by using DrScheme's "Install .plt file..." menu command: type in the URL http://home.adelphi.edu/sbloch/class/160/tiles.plt and you should see a bunch of messages ending with "Done setting up." You should only have to do this once for your home computer, and it should already be installed on the lab machines. After that, the functions will be available whenever you have the tiles teachpack loaded.

image-above : image image ... -> image

produces an image with the first image "above" (i.e. closer to the top of the screen) the second, which in turn is above the third, etc. The pinholes are lined up in the x dimension. If you apply image-above to two images, the pinhole of the result is halfway between the pinholes of the two images; if more than two, it's more complicated.

image-above-align-left : image image ... -> image

Like image-above, but lines up the left edges of all the images.

image-above-align-right : image image ... -> image

Like image-above, but lines up the right edges of all the images.

image-above-align-center : image image ... -> image

Like image-above, but lines up the centers of all the images.

image-beside : image image ... -> image

produces an image with the first image to the left of the second, which in turn is to the left of the third, etc. The pinholes are lined up in the y dimension. If you apply image-beside to two images, the pinhole of the result is halfway between the pinholes of the two images; if more than two, it's more complicated.

image-beside-align-top : image image ... -> image

Like image-beside, but lines up the top edges of all the images.

image-beside-align-bottom : image image ... -> image

Like image-beside, but lines up the bottom edges of all the images.

image-beside-align-center : image image ... -> image

Like image-beside, but lines up the centers of all the images.

reflect-vert : image -> image

Reflects the given image top-to-bottom.

reflect-horiz : image -> image

Reflects the given image left-to-right and bottom.

reflect-main-diag : image -> image

Reflects the given image across the diagonal from top-left to bottom-right; in other words, it swaps top-right with bottom-left.

reflect-other-diag : image -> image

Reflects the given image across the diagonal from top-right to bottom-left; in other words, it swaps top-left with bottom-right.

rotate-cw : image -> image

Rotates the given image 90 degrees clockwise around its pinhole.

rotate-ccw : image -> image

Rotates the given image 90 degrees counterclockwise around its pinhole.

rotate-180 : image -> image

Rotates the given image 180 degrees around its pinhole.

crop-top : image number -> image

Chops off a number of pixels from the top of the image.

crop-bottom : image number -> image

Chops off a number of pixels from the bottom of the image.

crop-left : image number -> image

Chops off a number of pixels from the left edge of the image.

crop-right : image number -> image

Chops off a number of pixels from the right edge of the image.

show-pinhole : image -> image

Adds a small black dot to the image so you can see where the pinhole is (useful in debugging).


Last modified: Mon Feb 19 00:19:16 EST 2007
Stephen Bloch / sbloch@adelphi.edu