Fundamentals of Computer Science I: Media Computing (CS151.02 2007F)

Assignment 3: Algorithmic Image Mosaics

Due: 4:00 p.m., Monday, 3 September 2007
No extensions!

This homework is also available in PDF.

Summary: In this assignment, you will use the basic pixel-manipulation techniques you learned in the lab on raster graphics to create simple color mosaics from source images.

Purposes: To get you comfortable working with the basic pixel operations in the GIMP. To help you think about colors.

Expected Time: One hour.

Collaboration: I would prefer that you work in groups of size three. However, you may work alone, in a group of size two, or a group of size four. You may discuss this assignment and possible solutions with anyone you wish. If you discuss this assignment with people other than group members, make sure to include a citation (e.g., I consulted this person, who helped me do this).

Submitting: Email me your answer. More details below. Each group need submit only one answer.

Warning: So that this assignment is a learning experience for everyone, I may spend class time publicly critiquing your work.



You now know a few simple techniques for dealing with images and the pixels in those images. In particular, you can load an image with image.load, create a new image with, get the value of a pixel at a particular location with image.get-pixel, set the value of a pixel at a particular location with image.set-pixel!, and determine the width and height of an image with image.width and image.height.

What can you do with this simple suite of procedures? One potentially interesting activity is to build new, simple, images from existing images. For example, you can take a small selection of pixels from one image and use those to build a new image. Such created art is a form of algorithmic art, art created by algorithm, rather than by hand.


Assume that we've defined image-file as the name of a file that contains an image. For example, we might have written

(define image-file "/home/rebelsky/glimmer/samples/emily-stalkernet.jpg")

a. Write a series of commands that builds and shows a new 4x4 image, each of whose pixels is taken from the image stored in image-file. Which pixels should you choose? It is up to you. One natural technique is to divide the original image into sixteen portions, and take the middle pixel in each quadrant.

b. Pick at least three images and generate mosaic images from them. Identify one that you find particularly appealing.

Important Evaluation Criteria

I will primarily look to see if you've tried something creative in choosing the pixels. I will also consider whether the algorithm you've come up with does anything interesting with typical pictures (whatever those are).

Submitting Your Homework

Please submit this work via email. The email should be titled CSC151.02 Assignment 03 and should contain your answers to all parts of this assignment. Please send your Scheme work as the body of an email message. Attach one source image and the corresponding result image.



Monday, 3 September 2007 [Samuel A. Rebelsky]

Saturday, 8 September 2007 [Samuel A. Rebelsky]


Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Mon Dec 3 09:55:52 2007.
The source to the document was last modified on Mon Sep 10 20:50:07 2007.
This document may be found at

You may wish to validate this document's HTML ; Valid CSS! ; Creative Commons License

Samuel A. Rebelsky,

Copyright © 2007 Janet Davis, Matthew Kluber, and Samuel A. Rebelsky. (Selected materials copyright by John David Stone and Henry Walker and used by permission.) This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.