imago

API Reference

imago

Image manipulation library

IMAGO

  • Type RGB-PIXEL
  • Type GRAYSCALE-PIXEL
  • Type INDEXED-PIXEL
  • Type PLANAR-PIXEL (&optional (plane-count '*))
  • Function MAKE-GRAY (intensity &optional (alpha 255))
  • Function GRAY-INTENSITY (gray)
  • Function GRAY-ALPHA (gray)
  • Function INVERT-GRAY (gray)
  • Function MAKE-COLOR (r g b &optional (alpha 255))
  • Function COLOR-RED (color)
  • Function COLOR-GREEN (color)
  • Function COLOR-BLUE (color)
  • Function COLOR-ALPHA (color)
  • Function COLOR-RGB (color)
  • Function COLOR-ARGB (color)
  • Function COLOR-INTENSITY (color)
  • Function INVERT-COLOR (color)
  • Variable +WHITE+
    (imago:make-color 255 255 255)
  • Variable +BLACK+
    (imago:make-color 0 0 0)
  • Variable +RED+
    (imago:make-color 255 0 0)
  • Variable +GREEN+
    (imago:make-color 0 255 0)
  • Variable +BLUE+
    (imago:make-color 0 0 255)
  • Variable +CYAN+
    (imago:make-color 0 255 255)
  • Variable +MAGENTA+
    (imago:make-color 255 0 255)
  • Variable +YELLOW+
    (imago:make-color 255 255 0)
  • Class IMAGE
    The protocol class for images.
    No slots.
  • Generic-Function IMAGE-PIXELS (image)
    Returns a rectangular array of the image pixels.
  • Generic-Function IMAGE-WIDTH (image)
    Returns the width of the image.
  • Generic-Function IMAGE-HEIGHT (image)
    Returns the height of the image.
  • Generic-Function IMAGE-PIXEL (image x y)
    Returns the color of the pixel at specified coordinates in the image.
  • Generic-Function (setf IMAGE-PIXEL) (pixel image x y)
    Sets the color of the pixel at specified coordinates in the image.
  • Method IMAGE-WIDTH ((image image))
  • Method IMAGE-HEIGHT ((image image))
  • Method IMAGE-PIXEL ((image image) x y)
  • Method (setf IMAGE-PIXEL) (pixel (image image) x y)
  • Class RGB-IMAGE  (IMAGE)
    The class for RGB images. Image dimensions must be provided to MAKE-INSTANCE, through the :WIDTH and :HEIGHT keyword parameters.
    PIXELS   Reader: IMAGE-PIXELS
  • Class GRAYSCALE-IMAGE  (IMAGE)
    The class for grayscale images. Image dimensions must be provided to MAKE-INSTANCE, through the :WIDTH and :HEIGHT keyword parameters.
    PIXELS   Reader: IMAGE-PIXELS
  • Class INDEXED-IMAGE  (IMAGE)
    The class for indexed images. Image dimensions must be provided to MAKE-INSTANCE, through the :WIDTH and :HEIGHT keyword parameters. Also accepts a :COLOR-COUNT keyword parameter, to specify the image color count (256 by default).
    PIXELS   Reader: IMAGE-PIXELS
    COLORMAP   Reader: IMAGE-COLORMAP
  • Class PLANAR-IMAGE  (IMAGE)
    The class for planar images. Image dimensions and plane count must be provided to MAKE-INSTANCE, through the :WIDTH, :HEIGHT, and :PLANE-COUNT keyword parameters, respectively.
    PIXELS   Reader: IMAGE-PIXELS
    PLANE-COUNT   Reader: IMAGE-PLANE-COUNT
    COLORMAP   Reader: IMAGE-COLORMAP
  • Macro WITH-IMAGE-DEFINITION ((image width height pixels) &body body)
    Binds the WIDTH, HEIGHT and PIXELS variables to the values corresponding to IMAGE, then evaluates the body.
  • Macro DO-IMAGE-PIXELS ((image color x y) &body body)
    Iterates through all pixels of an image. For each pixel, X and Y are bound to the pixel coordinates, and COLOR is a generalized variable corresponding to the pixel color.
  • Macro DO-REGION-PIXELS ((image color x y region-x region-y region-width region-height) &body body)
    Iterates through all pixels of a rectangular region in an image. For each pixel, X and Y are bound to the pixel coordinates, and COLOR is a generalized variable corresponding to the pixel color.
  • Macro DO-LINE-PIXELS ((image color x y x1 y1 x2 y2) &body body)
    Iterates through all pixels of a line segment in an image, corresponding to the X1, Y1, X2 and Y2 parameters. For each pixel, X and Y are bound to the pixel coordinates, and COLOR is a generalized variable corresponding to the pixel color.
  • Generic-Function SET-ALPHA (image alpha)
    Sets the alpha channel value for all pixels/colors in an image.
  • Method SET-ALPHA ((image rgb-image) alpha)
  • Method SET-ALPHA ((image grayscale-image) alpha)
  • Method SET-ALPHA ((image indexed-image) alpha)
  • Function DRAW-LINE (image x1 y1 x2 y2 color &key (dash-length 1) (dash-interval 0))
    Draws a line between two points in an image.
  • Function DRAW-RECTANGLE (image x1 y1 width height color &key (dash-length 1) (dash-interval 0))
    Draws a rectangle in an image.
  • Function DRAW-POLYGON (image coord-list color &key (closed t) (dash-length 1) (dash-interval 0))
    Draws a polygon in an image.
  • Function DRAW-CIRCLE (image center-x center-y radius color)
    Draws a circle in an image.
  • Function DRAW-BEZIER-CURVE (image x1 y1 x2 y2 x3 y3 x4 y4 color)
    Draws a cublic Bezier curve defined by a starting point, two control points, and an end point, in an image.
  • Generic-Function CONVERT-TO-RGB (image)
  • Generic-Function CONVERT-TO-GRAYSCALE (image)
  • Generic-Function CONVERT-TO-INDEXED (image)
  • Generic-Function CONVERT-TO-PLANAR (image)
  • Method CONVERT-TO-RGB ((image indexed-image))
  • Method CONVERT-TO-RGB ((image grayscale-image))
  • Method CONVERT-TO-GRAYSCALE ((image rgb-image))
  • Method CONVERT-TO-GRAYSCALE ((image indexed-image))
  • Method CONVERT-TO-INDEXED ((image rgb-image))
  • Method CONVERT-TO-INDEXED ((image grayscale-image))
  • Method CONVERT-TO-PLANAR ((image image))
  • Generic-Function CONVOLVE (image matrix divisor offset)
    Applies a 5x5 convolution kernel (a 5x5 real number matrix) to an image. Returns the resulting image.
  • Method CONVOLVE ((image rgb-image) matrix divisor offset)
  • Method CONVOLVE ((image grayscale-image) matrix divisor offset)
  • Function BLUR (image)
  • Function SHARPEN (image)
  • Function EDGE-DETECT (image)
  • Function EMBOSS (image &key (angle 0) (depth 1))
  • Generic-Function COMPOSE (dest image1 image2 x y operator)
    Composes IMAGE1 and IMAGE2 at offset (X, Y), using OPERATOR to compose each pixel. OPERATOR must be a function of two colors, returning a color.
  • Method COMPOSE ((dest (eql nil)) (image1 image) (image2 image) x y operator)
  • Generic-Function COPY (dest src &key dest-x dest-y src-x src-y width height)
    Copies a rectangular region from image SRC to image DEST. Both images must be large enough to contain the specified region at the given positions. Both images must be of same type.
  • Generic-Function SCALE (image width-factor height-factor)
    Returns an newly created image corresponding to the IMAGE image, with its dimensions multiplied by the given factors.
  • Generic-Function RESIZE (image new-width new-height)
    Returns an newly created image corresponding to the IMAGE image, with given dimensions.
  • Generic-Function FLIP (dest image axis)
    Flips an image. AXIS may be either :HORIZONTAL or :VERTICAL. DEST must be either an image of same type and dimensions as IMAGE, or NIL. Returns the resulting image.
  • Method COPY ((dest (eql nil)) (src image) &key (dest-x 0) (dest-y 0) (src-x 0) (src-y 0) width height)
  • Method COPY ((dest (eql nil)) (src indexed-image) &key dest-x dest-y src-x src-y width height)
  • Method COPY ((dest (eql nil)) (src planar-image) &key (dest-x 0) (dest-y 0) (src-x 0) (src-y 0) width height)
  • Method SCALE ((image image) width-factor height-factor)
  • Method RESIZE ((image image) new-width new-height)
  • Method FLIP ((dest (eql nil)) (image image) axis)
  • Function READ-IMAGE (filename &key (errorp t))
    Reads an image from a file. If the file format is not recognized, depending on the value of :ERRORP, either throws an error or returns NIL.
  • Function REGISTER-IMAGE-READER (extensions function)
    Register a reader function for some file extensions. The FUNCTION must take a FILESPEC as argument, and return an IMAGE.
  • Function READ-PNG (filespec)
  • Function WRITE-PNG (image filespec)
  • Function READ-PNM (filespec)
    Reads data for an image in PNM format from a file, and returns a newly created image correponding to those data.
  • Function WRITE-PNM (image filespec output-format)
    Writes the image data to a file in PNM format. OUTPUT-FORMAT can be either :ASCII or :BINARY.
  • Function READ-TGA (filespec)
  • Function WRITE-TGA (image filespec &key (top-down-p nil))
  • Function READ-PCX (filespec)
  • Function WRITE-PCX (image filespec &key (max-run-length 63) even-scanline-lengths-p)
    Write the given IMAGE to a Z-Soft PCX 3.0 format file named by FILESPEC. MAX-RUN-LENGTH => The longest run the PCX encoder will output. This can be as large as 63 (the default), but to support old and broken decoders, it should be set to 15. I've never seen a decoder so broken that it won't read >15 byte runs, but they do exist, so the option is here. EVEN-SCANLINE-LENGTHS-P => When set, will pad scanlines so that they are an even length. Supposedly there are decoders that want this behavior, but it's not necessary for most decoders.