Images
Basic Image Operations
-
(
image-new
width
height
) - MediaScheme GIMP Procedure. Create a new image of specified width and height.
-
(
image-load
filename
) - MediaScheme GIMP 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-save
image
fname
) - MediaScheme GIMP Procedure.
Save
image
in the specified file (which should provide the full path to the file). The type of the image (JPEG, GIF, PNG, etc.) is determined by the suffix of the file name. -
(
image-show
image
) - MediaScheme GIMP Procedure. Opens a new window with the image.
-
(
image-height
image
) - MediaScheme GIMP Procedure. Determine the height of the given image
-
(
image-width
image
) - MediaScheme GIMP Procedure. Determine the width of the given image.
Basic Drawing Operations
-
(
image-blot!
image
col
row
) - MediaScheme GIMP Procedure. Draw a spot in image at (col,row) with the current brush and foreground color.
-
(
image-draw-line!
image
col1
row1
col2
row2
) - MediaScheme GIMP Procedure. Draw a line in image from (col1,row1) to (col2,row2). Uses the current brush and foreground color.
Pixel-Based Operations
-
(
image-get-pixel
image
column
row
) - MediaScheme GIMP Procedure. Get the pixel at the specified position in the image.
-
(
image-set-pixel!
image
column
row
rgb-color
) - MediaScheme GIMP Procedure. Set the pixel at the specified position to the new color.
-
(
image-transform-pixel!
image
column
row
func
) - MediaScheme GIMP Procedure.
Modify the pixel at
(
col
,row
) inimage
by applyingfunc
to its old color and setting that pixel to the resulting color.
Higher-Order Procedures
-
(
image-calculate-pixels!
image
fun
- MediaScheme GIMP Procedure.
Fills in all the pixels in the image by setting the color at
each position to the result of applying
fun
to the column and row.fun
should have the form(lambda (col row) color)
. Unlikeimage-compute-pixels!
, which can compute pixels in any order,image-calculate-pixels!
is guaranteed to do a row-by-row, left-to-right scan through the image. However,image-calculate-pixels!
is likely to be slower thanimage-compute-pixels!
(although faster than coding the iteration yourself). -
(
image-compute
pos2color
width
height
) - MediaScript GIMP Procedure. Create a new
width-by-height image by using
pos2color
(a function of the form(lambda (col row) color)
) to compute the color at each position in the image. -
(
image-compute-pixels!
image
pos2color
) - MediaScheme GIMP Procedure.
Set each pixel in the image to the result of applying
function
to the position of the pixel.function
must have the form(lambda (col row) expression-to-compute-color)
. -
(
image-redo!
image
fun
) - MediaScheme GIMP Procedure.
Scans through the image, replacing the color at each pixel in
the selected region (or the whole image, if nothing is selected)
with the result of applying
fun
to the column, row, and current color at each position.fun
should therefore have the form(lambda (col row color) newcolor)
. Iffun
returnsIRGB-TRANSPARENT
, leaves the pixel unchanged. -
(
image-scan
image
proc!
) - MediaScheme GIMP Procedure.
Scans through the image, applying
proc!
the the column, row, and color at each position.proc!
should have the form(lambda (col row color) ...)
. In contrast to many of the other image iteration procedures,image-scan
is guaranteed to scan row-by-row from top-to-bottom, scanning each row from left to right. -
(
image-transform!
image
fun
) - MediaScheme GIMP Procedure.
Transform
image
in place by setting each pixel to the result of applyingfun
to that current pixel color. -
(
image-variant
image
fun
) - MediaScheme GIMP Procedure.
Create a new image of the same width and height as
image
, each of whose pixels is computed by applyingfun
to the color of the corresponding pixel inimage
. -
(
region-calculate-pixels!
image
left
top
width
height
fun
- MediaScheme GIMP Procedure.
Creates a region of the image by applying
fun
at each position in the region.fun
should have the form(lambda (col row) color)
. Unlikeregion-compute-pixels!
, which can compute pixels in any order,region-calculate-pixels!
is guaranteed to do a row-by-row, left-to-right scan through the image. However,region-calculate-pixels!
is likely to be slower thanregion-compute-pixels!
(although faster than coding the iteration yourself). -
(
region-compute-pixels!
image
left
top
width
height
pos2color
) - MediaScheme GIMP 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 of the form(lambda (col row) expression-to-compute-color)
. -
(
region-scan
image
left
top
width
height
proc!
) - MediaScheme GIMP Procedure.
Scans through a region of the image, applying
proc!
at each position in the region.proc!
should have the form(lambda (col row color) ...)
. In contrast to many of the other region procedures,region-scan
is guaranteed to scan row-by-row from top-to-bottom, scanning each row from left to right.
Selection Procedures
-
(
image-select-all!
image
) - MediaScheme GIMP Procedure. Selects all of the pixels in the image.
-
(
image-select-ellipse!
image
selection-type
left
top
width
height
) - MediaScheme GIMP Procedure.
Select an ellipse whose left margin is
left
, top margin istop
, width iswidth
and height isheight
. Ifselection-type
isREPLACE
, the ellipse replaces the current selection. Ifselection-type
isADD
, the ellipse is added to the current selection. Ifselection-type
isSUBTRACT
, the ellipse is subtracted from the current selection. Ifselection-type
isINTERSECT
, the ellipse is intersected with the current selection (that is, only points that are in both the current selection and the ellipse remain selected). -
(
image-select-inverse!
image
) - MediaScheme GIMP Procedure. Selects the inverse of all selected images in the image.
-
(
image-select-nothing!
image
) - MediaScheme GIMP Procedure. Clears the current selection. Afterwards, nothing is selected.
-
(
image-select-polygon!
image
selection-type
positions
) - MediaScheme GIMP Procedure.
Select a polygon described by the given list of positions
(each created by
position-new
). Ifselection-type
isREPLACE
, the polygon replaces the current selection. Ifselection-type
isADD
, the polygon is added to the current selection. Ifselection-type
isSUBTRACT
, the polygon is subtracted from the current selection. Ifselection-type
isINTERSECT
, the polygon is intersected with the current selection (that is, only points that are in both the current selection and the polygon remain selected). -
(
image-select-rectangle!
image
selection-type
left
top
width
height
) - MediaScheme GIMP Procedure.
Select an rectangle whose left margin is
left
, top margin istop
, width iswidth
and height isheight
. Ifselection-type
isREPLACE
, the rectangle replaces the current selection. Ifselection-type
isADD
, the rectangle is added to the current selection. Ifselection-type
isSUBTRACT
, the rectangle is subtracted from the current selection. Ifselection-type
isINTERSECT
, the rectangle is intersected with the current selection (that is, only points that are in both the current selection and the rectangle remain selected).
-
(
image-fill-selection!
image
) - MediaScheme GIMP Procedure. Fill the selected region of the given image with the current foreground color.
-
(
image-stroke-selection!
image
) - MediaScheme GIMP Procedure. Traces the edge of the selected region of the given image with the current brush and foreground color.
Additional Image Procedures
-
(
image-airbrush-line!
image
pressure
col1
row1
col2
row2
) - MediaScheme GIMP Procedure. Draw a line in image from (col1,row1) to (col2,row2). Uses the airbrush and foreground color. The pressure should be between 0 and 100 (inclusive).
-
(
image-copy-paste-block!
source
source-col
source-row
target
target-col
target-row
width
height
) - MediaScheme GIMP Procedure.
Copy a
width
-by-height
region fromsource
totarget
. The (col,row) pairs specify the top-left corner of the region in each image. -
(
image-refresh-display!
image
) - MediaScheme GIMP Procedure.
Refreshes the display of the given image. (While
context-update-displays!
should update displays, it doesn't always work. This procedure forces an update. And it still doesn't always work. Doing a new call toimage-show
seems to refresh all copies of the image.)