Fundamentals of Computer Science I: Media Computing (CS151.01 2008S)

Reference for Image-based Procedures


Basic Image Operations

(image-new width height)
DrFu procedure. Create a new image of specified width and height.
(image-load filename)
DrFu procedure. Load an image from a file. The name of the file is a string (and, unless a named value, typically surrounded by quotation marks).
(image-show image)
DrFu procedure. Opens a new window with the image.
(image-height image)
DrFu procedure. Determine the height of the given image
(image-width image)
DrFu procedure. Determine the width of the given image.

Pixel-Based Operations

(image-get-pixel image column row)
DrFu procedure. Get the pixel at the specified posi tion in the image.
(image-set-pixel! image column row rgb-color)
DrFu procedure. Set the pixel at the specified position to the new color.
(image-transform-pixel! image column row func)
DrFu procedure. Modify the pixel at (col,row) in image by applying func to its old color and setting that pixel to the resulting color.

Higher-Order Procedures

<xi:include></xi:include>
(image-transform! image fun)
DrFu procedure. Transform image in place by setting each pixel to the result of applying fun to that current pixel color.
(image-compute-pixels! image first-col first-row last-col last-row function)
DrFu procedure. Create a portion of an image by setting each pixel in the specified region to the result of applying function to the position of the pixel. function must be a function from position to rgb-color. Warning! The current version is buggy, and may affect other pixels.

Creative Commons License

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-8 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 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.