# Class 39: Manipulating Images with Script-Fu

Back to Discussion of Exam 2. On to Drawing with Script-Fu.

This outline is also available in PDF.

Held: Wednesday, April 11, 2007

Summary: Today we consider some procedures for manipulating existing images.

Related Pages:

Notes:

• If you got at least a B on the exam, you should think about going on to the wonders of CSC152 in the fall.
• If you needed the "There's more to CS" fix, consider getting a Tutor or setting up a regular appointment with me.
• Are there questions on Homework 12?

Overview:

• Primary image-manipulation procedures.
• color transformations.
• Lab.

## Manipulating Images Programmatically

• Each image that the Gimp creates is effectively just a two-dimensional grid of color values.
• Hence, we can do interesting things using those color values.
• We can generate those color values using some formula.
• We can modify those color values using some formula.
• We can move those color values around.
• I call the use of algorithms to accomplish those and similar purposes algorithmic art.
• I've built a number of procedures to help with those purposes.
• The procedure `(get-color-at image x y)` gets a color from an image.
• The procedure `(set-color-at! image x y color)` sets a color in an image.
• The procedure `(modify-image! transform image)` applies `transform` to every point in the image.

## Color Transformers

• There are a vareity of techniques for transforming colors.
• We build a color with `(rgb red green blue)`
• We extract the components with `(red color)`, `(green color)`, and `(blue color)`.
• When we write our transformers, we can use a variety of techniques
• anonymous procedures
• curried procedures
• sectioned procedures
• procedure composition
• For now, you'll start to learn the basic ways to use these procedures.
• Soon, you'll learn some theory and practice.

## Lab

Back to Discussion of Exam 2. On to Drawing with Script-Fu.

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 Thu Sep 13 20:54:51 2007.
The source to the document was last modified on Thu Jan 18 12:30:12 2007.
This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2007S/Outlines/outline.39.html`.

You may wish to validate this document's HTML ; ;

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright © 2007 Samuel A. Rebelsky. This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit `http://creativecommons.org/licenses/by-nc/2.5/` or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.