Images
Basic Image Operations
-
(image-newwidthheight) - MediaScheme GIMP Procedure. Create a new image of specified width and height.
-
(image-loadfilename) - 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-saveimagefname) - MediaScheme GIMP Procedure.
Save
imagein 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-showimage) - MediaScheme GIMP Procedure. Opens a new window with the image.
-
(image-heightimage) - MediaScheme GIMP Procedure. Determine the height of the given image
-
(image-widthimage) - MediaScheme GIMP Procedure. Determine the width of the given image.
Basic Drawing Operations
-
(image-blot!imagecolrow) - MediaScheme GIMP Procedure. Draw a spot in image at (col,row) with the current brush and foreground color.
-
(image-draw-line!imagecol1row1col2row2) - 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-pixelimagecolumnrow) - MediaScheme GIMP Procedure. Get the pixel at the specified position in the image.
-
(image-set-pixel!imagecolumnrowrgb-color) - MediaScheme GIMP Procedure. Set the pixel at the specified position to the new color.
-
(image-transform-pixel!imagecolumnrowfunc) - MediaScheme GIMP Procedure.
Modify the pixel at
(
col,row) inimageby applyingfuncto its old color and setting that pixel to the resulting color.
Higher-Order Procedures
-
(image-calculate-pixels!imagefun - MediaScheme GIMP Procedure.
Fills in all the pixels in the image by setting the color at
each position to the result of applying
funto the column and row.funshould 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-computepos2colorwidthheight) - 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!imagepos2color) - MediaScheme GIMP Procedure.
Set each pixel in the image to the result of applying
functionto the position of the pixel.functionmust have the form(lambda (col row) expression-to-compute-color). -
(image-redo!imagefun) - 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
funto the column, row, and current color at each position.funshould therefore have the form(lambda (col row color) newcolor). IffunreturnsIRGB-TRANSPARENT, leaves the pixel unchanged. -
(image-scanimageproc!) - 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-scanis guaranteed to scan row-by-row from top-to-bottom, scanning each row from left to right. -
(image-transform!imagefun) - MediaScheme GIMP Procedure.
Transform
imagein place by setting each pixel to the result of applyingfunto that current pixel color. -
(image-variantimagefun) - MediaScheme GIMP Procedure.
Create a new image of the same width and height as
image, each of whose pixels is computed by applyingfunto the color of the corresponding pixel inimage. -
(region-calculate-pixels!imagelefttopwidthheightfun - MediaScheme GIMP Procedure.
Creates a region of the image by applying
funat each position in the region.funshould 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!imagelefttopwidthheightpos2color) - MediaScheme GIMP Procedure.
Create a portion of an image by setting each pixel
in the specified region to the result of applying
functionto the position of the pixel.functionmust be a function of the form(lambda (col row) expression-to-compute-color). -
(region-scanimagelefttopwidthheightproc!) - 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-scanis 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!imageselection-typelefttopwidthheight) - MediaScheme GIMP Procedure.
Select an ellipse whose left margin is
left, top margin istop, width iswidthand height isheight. Ifselection-typeisREPLACE, the ellipse replaces the current selection. Ifselection-typeisADD, the ellipse is added to the current selection. Ifselection-typeisSUBTRACT, the ellipse is subtracted from the current selection. Ifselection-typeisINTERSECT, 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!imageselection-typepositions) - MediaScheme GIMP Procedure.
Select a polygon described by the given list of positions
(each created by
position-new). Ifselection-typeisREPLACE, the polygon replaces the current selection. Ifselection-typeisADD, the polygon is added to the current selection. Ifselection-typeisSUBTRACT, the polygon is subtracted from the current selection. Ifselection-typeisINTERSECT, 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!imageselection-typelefttopwidthheight) - MediaScheme GIMP Procedure.
Select an rectangle whose left margin is
left, top margin istop, width iswidthand height isheight. Ifselection-typeisREPLACE, the rectangle replaces the current selection. Ifselection-typeisADD, the rectangle is added to the current selection. Ifselection-typeisSUBTRACT, the rectangle is subtracted from the current selection. Ifselection-typeisINTERSECT, 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!imagepressurecol1row1col2row2) - 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!sourcesource-colsource-rowtargettarget-coltarget-rowwidthheight) - MediaScheme GIMP Procedure.
Copy a
width-by-heightregion fromsourcetotarget. 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-showseems to refresh all copies of the image.)