Skip to content
This repository

Remix Scripts

High Level

Scripts run with access to three variables foreground, background and composite (with short names fg, bg and comp). These are slightly restricted Canvas 2d Rendering Context objects. foreground and background are the remix layers, and can be modified. composite is rendered combination all layers (what you see in the remix editor).

Canvas 2d Context resources


  • foreground or fg
  • background or bg
  • composite or comp
  • layers

    • layers.clone(ctx) takes a context (like foreground) and returns a read/write copy of it.
    • layers.temp(width, height) returns a context into a temporary layer. If you don't pass width and height they default to the size of the image currently being edited.
  • util

    • util.clear(ctx) clears the whole context. Shortcut for ctx.clearRect(0,0, ctx.canvas.width, ctx.canvas.height)




Scripts are run through Caja, a javascript sandboxing system. Currently javascript is restricted to safe global functions like Math.round, and has no access to the DOM, AJAX calls or other potentially unsafe or undesired functions.

Something went wrong with that request. Please try again.