Sandbox

{{session.name}} {{session.description}}


Images

{{image.name}}



Success!
Line {{error.lineNumber}}: {{error.message}}

Log

  • {{log}}
Hit Run to start editing images!

Quick Tripod Reference

For more in-depth reference, check out the Help tab.

TImage

Represents an image that you can create or load.

Creating a TImage:

  • new TImage(source) - creates a TImage from a pre-loaded image (see sidebar.)

Working with a TImage:

Function Returns Description
getWidth() Number Width (# columns)
getHeight() Number Height (# rows)
getSize() Number Number of pixels (width * height)
getAllPixels() TPixel array All the pixels in the image
getPixelAt(x, y) TPixel Pixel at column x, row y
ellipse(x, y, width, height) nothing Draws an ellipse centered at (x, y)
rect(x, y, width, height) nothing Draws a rect with top left corner at (x, y)
text(text, x, y) nothing Draws the given text at (x, y); its positioning relative to (x, y) is determined by the text alignment
refresh() nothing Updates the image - call after editing image
getBrushColor() Number array The color used for outlines of shapes and text; red, green, blue, and alpha in that order
setBrushColor(r, g, b, [a]) nothing Changes outline color; the last parameter, alpha, is optional and will be 255 (fully opaque) if you don't provide it
getBucketColor() Number array The color used to fill shapes and text; red, green, blue, and alpha in that order
setBucketColor(r, g, b, [a]) nothing Changes fill color; the last parameter, alpha, is optional and will be 255 (fully opaque) if you don't provide it
setTextSize(size) nothing Changes the text size, in pixels
setTextFont(font) nothing Changes the text font (default is 'sans-serif')
setTextAlign(align) nothing Changes the text's horizontal alignment ("left", "center", or "right")
setTextVerticalAlign(align) nothing Changes the text's vertical alignment ("top", "middle", or "bottom")

TPixel

Represents a pixel (one dot) in a TImage.

Working with a TPixel:

Function Returns Description
getRed() Number Red value (0-255)
setRed(r) nothing Changes red value (0-255)
getGreen() Number Green value (0-255)
setGreen(g) nothing Changes green value (0-255)
getBlue() Number Blue value (0-255)
setBlue(b) nothing Changes blue value (0-255)
getAlpha() Number Alpha (transparency) value (0-255)
setAlpha(a) Number Changes alpha (transparency) value (0-255)
setRGBA(r, g, b, [a]) nothing Changes red, green, blue, and alpha (transparency) all at once; the last parameter, alpha, is optional and will be 255 (fully opaque) if you don't provide it
getRGBA() Number array Red, green, blue, and alpha (transparency), in that order