On this page:
image?
image=?
circle
nw: rectangle
rectangle
triangle
ellipse
line
text
image-url
star
empty-scene
place-image
overlay
overlay/ xy
underlay
underlay/ xy
rotate
scale
scale/ xy
put-pinhole
image-width
image-height
make-color
color-red
color-green
color-blue
5.1 Available colors

5 Images

 (require (planet dyoo/js-vm:1:12/image/image))
The contents of this module need to run in a Javascript context.

This module provides functions for creating images. The design of the library is meant to follow 2htdp/image.

(image? x)  boolean?
  x : any/c
Produces #t if x is an image, and #f otherwise.

(image=? x y)  boolean?
  x : any/c
  y : any/c
Produces #t if x is the same image as y.

(circle radius style color)  image?
  radius : nonnegative-real?
  style : (one-of/c 'solid 'outline)
  color : color?
Produces a circle image with the given radius, style, and color.

(nw:rectangle width height style color)  image?
  width : number?
  height : number?
  style : (one-of/c 'solid 'outline)
  color : color?
Produces a rectangle whose pinhole is at the upper left corner.

(rectangle width height style color)  image?
  width : number?
  height : number?
  style : (one-of/c 'solid 'outline)
  color : color?
Produces a rectangle whose pinhole is at its center.

Produces a triangle.

(ellipse)  image?

(line)  image?
Creates a line.

(text message size color)  image?
  message : string?
  size : number?
  color : color?
Creates a text image.

(image-url url)  image?
  url : string?
Reads in the image at the provided url and produces an image of its contents.

(star)  image?
Creates a star image

(empty-scene width height)  image?
  width : number?
  height : number?
Produces an empty scene with a border.

(place-image x y an-image background)  image?
  x : number?
  y : number?
  an-image : image?
  background : image?
Places an-image on top of background at the given x, y coordinate.

(overlay img1 img2 ...)  image?
  img1 : image?
  img2 : image?
(overlay/xy img1 x y img2)  image?
  img1 : image?
  x : real?
  y : real?
  img2 : image?
(underlay img1 img2 ...)  image?
  img1 : image?
  img2 : image?
(underlay/xy img1 x y img2)  image?
  img1 : image?
  x : real?
  y : real?
  img2 : image?

(rotate degree img)  image?
  degree : real?
  img : image?
Rotates the given by the degree.

(scale factor img)  image?
  factor : real?
  img : image?
Scales the image.

(scale/xy x-factor y-factor img)  image?
  x-factor : real?
  y-factor : real?
  img : image?
Scales the image by the given x-factor, y-factor.

(put-pinhole img x y)  image?
  img : image?
  x : real?
  y : real?

(image-width an-image)  number?
  an-image : image?
Produces the width of an image.
(image-height an-image)  number?
  an-image : image?
Produces the height of an image.

Colors can be specified either by an RGB color structure, or by string name. Both are described now.

(make-color red green blue)  color
  red : number?
  green : number?
  blue : number?
Produces a color with the given RGB triplet.

(color-red c)  number
  c : color?
Selects the red part of the color.
(color-green c)  number
  c : color?
Selects the green part of the color.
(color-blue c)  number
  c : color?
Selects the blue part of the color.

5.1 Available colors

Here is a complete list of the strings that image will recognize as colors.
  • "orange"

  • "red"

  • "orangered"

  • "tomato"

  • "darkred"

  • "red"

  • "firebrick"

  • "crimson"

  • "deeppink"

  • "maroon"

  • "indian red"

  • "indianred"

  • "medium violet red"

  • "mediumvioletred"

  • "violet red"

  • "violetred"

  • "lightcoral"

  • "hotpink"

  • "palevioletred"

  • "lightpink"

  • "rosybrown"

  • "pink"

  • "orchid"

  • "lavenderblush"

  • "snow"

  • "chocolate"

  • "saddlebrown"

  • "brown"

  • "darkorange"

  • "coral"

  • "sienna"

  • "orange"

  • "salmon"

  • "peru"

  • "darkgoldenrod"

  • "goldenrod"

  • "sandybrown"

  • "lightsalmon"

  • "darksalmon"

  • "gold"

  • "yellow"

  • "olive"

  • "burlywood"

  • "tan"

  • "navajowhite"

  • "peachpuff"

  • "khaki"

  • "darkkhaki"

  • "moccasin"

  • "wheat"

  • "bisque"

  • "palegoldenrod"

  • "blanchedalmond"

  • "medium goldenrod"

  • "mediumgoldenrod"

  • "papayawhip"

  • "mistyrose"

  • "lemonchiffon"

  • "antiquewhite"

  • "cornsilk"

  • "lightgoldenrodyellow"

  • "oldlace"

  • "linen"

  • "lightyellow"

  • "seashell"

  • "beige"

  • "floralwhite"

  • "ivory"

  • "green"

  • "lawngreen"

  • "chartreuse"

  • "green yellow"

  • "greenyellow"

  • "yellow green"

  • "yellowgreen"

  • "medium forest green"

  • "olivedrab"

  • "mediumforestgreen"

  • "dark olive green"

  • "darkolivegreen"

  • "darkseagreen"

  • "lime"

  • "dark green"

  • "darkgreen"

  • "lime green"

  • "limegreen"

  • "forest green"

  • "forestgreen"

  • "spring green"

  • "springgreen"

  • "medium spring green"

  • "mediumspringgreen"

  • "sea green"

  • "seagreen"

  • "medium sea green"

  • "mediumseagreen"

  • "aquamarine"

  • "lightgreen"

  • "pale green"

  • "palegreen"

  • "medium aquamarine"

  • "mediumaquamarine"

  • "turquoise"

  • "lightseagreen"

  • "medium turquoise"

  • "mediumturquoise"

  • "honeydew"

  • "mintcream"

  • "royalblue"

  • "dodgerblue"

  • "deepskyblue"

  • "cornflowerblue"

  • "steel blue"

  • "steelblue"

  • "lightskyblue"

  • "dark turquoise"

  • "darkturquoise"

  • "cyan"

  • "aqua"

  • "darkcyan"

  • "teal"

  • "sky blue"

  • "skyblue"

  • "cadet blue"

  • "cadetblue"

  • "dark slate gray"

  • "darkslategray"

  • "lightslategray"

  • "slategray"

  • "light steel blue"

  • "lightsteelblue"

  • "light blue"

  • "lightblue"

  • "powderblue"

  • "paleturquoise"

  • "lightcyan"

  • "aliceblue"

  • "azure"

  • "medium blue"

  • "mediumblue"

  • "darkblue"

  • "midnight blue"

  • "midnightblue"

  • "navy"

  • "blue"

  • "indigo"

  • "blue violet"

  • "blueviolet"

  • "medium slate blue"

  • "mediumslateblue"

  • "slate blue"

  • "slateblue"

  • "purple"

  • "dark slate blue"

  • "darkslateblue"

  • "darkviolet"

  • "dark orchid"

  • "darkorchid"

  • "mediumpurple"

  • "cornflower blue"

  • "medium orchid"

  • "mediumorchid"

  • "magenta"

  • "fuchsia"

  • "darkmagenta"

  • "violet"

  • "plum"

  • "lavender"

  • "thistle"

  • "ghostwhite"

  • "white"

  • "whitesmoke"

  • "gainsboro"

  • "light gray"

  • "lightgray"

  • "silver"

  • "gray"

  • "dark gray"

  • "darkgray"

  • "dim gray"

  • "dimgray"

  • "black"