Working with Images in DrRacket

DrRacket supports images as a basic kind of data. You can give images as arguments to functions and have functions return images. Here's a starter guide for working with images.

Loading your own Images

Most class assignments will give you images to work with. If you want to load your own images:

  1. Make sure the image you want to use is on your computer or in your account.
  2. Under the "Insert" menu, select "Insert Image".
  3. Using the dialog box that comes up, open the image file. You can load the standard image formats (gif, jpg, bmp, and probably others).

If you save the definitions window when it contains images, the images will be saved as well. Just be aware that files with images are no longer text files, so they won't print/view normally if you print/view them from outside DrRacket.

Image Operations

The best way to get the current list of image operations is to open DrRacket's HelpDesk (under the help menu) and search for image.ss. In this teachpack you'll find contracts and purpose statements for all image operations defined at your current language level. The operations let you combine images, get the dimensions of images, and search for one image inside another (among other things). Also included are operations for creating solid and outlined rectangles, circles, and other shapes as basic images.