Plan Documentation

Image Plans (0.9.2)

Plans to Get an Image


Custom Image

Summery

Make a custom image

Description

Make an image with instruction x. Instruction forms include: box(width,height,color), ellipse(width,height,color), and line(width,height,color). Width and height are the image pixel dimensions and color is an optional color parameter specified as #RRGGBB, #AARRGGBB, or a named SVG color keyword provided by the World Wide Web Consortium. The image is plotted on a transparent background.

Example

x = {box(10,10,black)}{...}
x = {circle(22,#A0C074)}{...}
x = {ellipse(20,10)}{...}
x = {line(120,-100,red)}{...}

Fill Image

Summery

Fill an image with a color

Description

Fill a w×h image with color array consisting of color channels as {red,green,blue,alpha} where each array value ranges from 0 to 255.

Example

w = {100};h = {50};color = {160,192,116,255}{...}

Image of a Text

Summery

Make an image of text

Description

Make a w×h image of a centered text, with font description, scene color, and pen color.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {160,192,116,255};font = {};text = {Hello World!}{...}
w = {100};h = {50};scene color = {255,255,255,255};pen color = {160,192,116,255};font = {Helvetica,12};text = {Hello World!}{...}

Image of Points

Summery

Make an image of points

Description

Make a w×h image of points A(Ax,Ay), with scene color, pen color, and pen width. For each available k, one point is plotted at (Ax[k], Ay[k]) with pen width[k] and pen color[4k,4k+1,4k+2,4k+3](RGBA), or the last pen width and pen color when not available.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255, 0,0,0,255, 160,192,116,255};pen width = {0,0,2};Ax = {7,20,60};Ay = {15,5,42}{...}

Image of Lines

Summery

Make an image of lines

Description

Make a w×h image of straight lines between points A(Ax,Ay) and B(Bx,By), with scene color, pen color, and pen width. For each available k, one line is plotted between (Ax[k],Ay[k]) and (Bx[k],By[k]) with pen width[k] and pen color[4k,4k+1,4k+2,4k+3](RGBA), or the last pen width and pen color when not available.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255, 0,0,0,255, 160,192,116,255};pen width = {0,0,2};Ax = {7,20,60};Ay = {15,5,42};Bx = {3,3,3};By = {3,3,3}{...}

Image of a Bézier Spline

Summery

Make an image of a Bézier curve

Description

Make a w×h image of a cubic Bézier spline strip between points A(Ax,Ay), and control points C1(C1x,C1y) and C2(C2x,C2y), with scene color, fill color, pen color, and pen width. The cubic spline is plotted between (Ax[k],Ay[k]) and (Ax[k+1],Ay[k+1]) with control points (C1x[k],C1y[k]) and (C2x[k],C2y[k]) for each available k.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255};fill color = {160,192,116,255};pen width = {2};Ax = {7,20,60};Ay = {15,5,42};C1x = {7,-3};C1y = {12,-3};C2x = {-5,0};C2y = {-5,0}{...}

Image of Rectangles

Summery

Make an image of rectangles

Description

Make a w×h image of rectangles between corners A(Ax,Ay) and B(Bx,By), rounded with corner radii rx and ry, with scene color, fill color, pen color, and pen width. For each available k, one rectangle is plotted between (Ax[k],Ay[k]) and (Bx[k],By[k]) with pen width[k], pen color[4k,4k+1,4k+2,4k+3](RGBA), fill color[4k,4k+1,4k+2,4k+3](RGBA), and corner radii rx[x] and ry[k], or the last pen width, pen color, fill color, rx, and ry when not available.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255};fill color = {160,192,116,255};pen width = {2,0};Ax = {7,20,60};Ay = {15,5,42};Bx = {10,55,5};By = {20,30,30};rx = {1,2,4};ry = {1,5,2}{...}

Image of a Polygon

Summery

Make an image of a polygon

Description

Make a w×h image of a polygon between corners A(Ax,Ay), with scene color, fill color, pen color, and pen width.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255};fill color = {160,192,116,255};pen width = {2};Ax = {10,20,80,55,30};Ay = {10,5,12,40,35}{...}

Image of Arcs

Summery

Make an image of arcs

Description

Make a w×h image of arcs enclosed in rectangles between corners A(Ax,Ay) and B(Bx,By) with start angle, span angle, scene color, pen color, and pen width. For each available k, one arc is plotted in a rectangle defined by (Ax[k],Ay[k]) and (Bx[k],By[k]), starting at start angle[k] for span angle[k], with pen width[k] and pen color[4k,4k+1,4k+2,4k+3](RGBA), or the last pen width and pen color when not available.Angles are in degrees, positive angles are counter-clockwise, and zero is at the 3 o'clock position.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255};pen width = {2,0};Ax = {7,20,60};Ay = {15,5,42};Bx = {10,55,5};By = {20,30,30};start angle = {0,90,180};span angle = {180,360,-90}{...}

Image of Chords

Summery

Make an image of chords

Description

Make a w×h image of chords enclosed in rectangles between corners A(Ax,Ay) and B(Bx,By) with start angle, span angle, scene color, fill color, pen color, and pen width. For each available k, one chord is plotted in a rectangle defined by (Ax[k],Ay[k]) and (Bx[k],By[k]), starting at start angle[k] for span angle[k], with pen width[k], pen color[4k,4k+1,4k+2,4k+3](RGBA), and fill color[4k,4k+1,4k+2,4k+3](RGBA), or the last pen width, pen color, and fill color when not available. Angles are in degrees, positive angles are counter-clockwise, and zero is at the 3 o'clock position.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255};fill color = {160,192,116,255};pen width = {2,0};Ax = {7,20,60};Ay = {15,5,42};Bx = {10,55,5};By = {20,30,30};start angle = {0,90,180};span angle = {180,360,-90}{...}

Image of Pies

Summery

Make an image of pies

Description

Make a w×h image of pies enclosed in rectangles between corners A(Ax,Ay) and B(Bx,By) with start angle, span angle, scene color, fill color, pen color, and pen width. For each available k, one pie is plotted in a rectangle defined by (Ax[k],Ay[k]) and (Bx[k],By[k]), starting at start angle[k] for span angle[k], with pen width[k], pen color[4k,4k+1,4k+2,4k+3](RGBA), and fill color[4k,4k+1,4k+2,4k+3](RGBA), or the last pen width, pen color, and fill color when not available. Angles are in degrees, positive angles are counter-clockwise, and zero is at the 3 o'clock position.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255};fill color = {160,192,116,255};pen width = {2,0};Ax = {7,20,60};Ay = {15,5,42};Bx = {10,55,5};By = {20,30,30};start angle = {0,90,180};span angle = {180,360,-90}{...}

Image of Ellipses

Summery

Make an image of ellipses

Description

Make a w×h image of ellipses centered at A(Ax,Ay) with radii rx and ry, scene color, fill color, pen color, and pen width. For each available k, one ellipse is plotted with center (Ax[k],Ay[k]) and radii rx[k] and ry[k], pen width[k], pen color[4k,4k+1,4k+2,4k+3](RGBA), fill color[4k,4k+1,4k+2,4k+3](RGBA), or the last pen width, pen color, and fill color when not available.

Example

w = {100};h = {50};scene color = {255,255,255,255};pen color = {0,0,0,255};fill color = {160,192,116,255};pen width = {2,0};Ax = {10,20,60};Ay = {10,35,12};rx = {2,15,8};ry = {4,15,8}{...}

Import With Format Auto-Detect

Summery

Import an image with format auto-detect

Description

Import an image from file name with format auto-detect.

Example

file name = {tests\testimage.png}{...}

Import From BMP File

Summery

Import an image from BMP file

Description

Import an image from a Windows Bit Map (BMP) file at file name.

Example

file name = {tests\testimage.bmp}{...}

Import From GIF File

Summery

Import an image from GIF file

Description

Import an image from a Graphic Interchange Format (GIF) file at file name.

Example

file name = {tests\flower.gif}{...}

Import From JPG File

Summery

Import an image from JPG file

Description

Import an image from a Joint Photographic Experts Group (JPG) file at file name.

Example

file name = {tests\testimage.jpg}{...}

Import From PNG File

Summery

Import an image from PNG file

Description

Import an image from a Portable Network Graphics (PNG) file at file name.

Example

file name = {tests\testimage.png}{...}

Import From PBM File

Summery

Import an image from PBM file

Description

Import an image from a Portable Bit Map (PBM) file at file name.

Example

file name = {tests\sierpinski.pbm}{...}

Import From PGM File

Summery

Import an image from PGM file

Description

Import an image from a Portable Gray Map (PGM) file at file name.

Example

file name = {tests\buffalo.pgm}{...}

Import From PPM File

Summery

Import an image from PPM file

Description

Import an image from a Portable Pixel Map (PPM) file at file name.

Example

file name = {tests\blackbuck.ppm}{...}

Import From XBM File

Summery

Import an image from XBM file

Description

Import an image from an X11 Bit Map (XBM) file at file name.

Example

file name = {tests\testimage.xbm}{...}

Import From XPM File

Summery

Import an image from XPM file

Description

Import an image from an X11 Pixel Map (XPM) file at file name.

Example

file name = {tests\teapot.xpm}{...}

Import From Video File

Summery

Import an image from video file

Description

Import a frame from a video file at file name with an api. api is the OpenCV VideoCapture api back-end identifier where api=0 auto detects the available back-end.

Example

file name = {tests\face.avi};api = {0};frame = {3}{...}

Import From Camera

Summery

Capture an image from streaming device

Description

Capture an image from a streaming device at device id with an api. device id=0 captures the default camera. api is the OpenCV VideoCapture API back-end identifier where api=0 auto detects the available back-end.
Note: Cameras may require a few frame captures to flush their buffer before taking a clear image.

Example

device id = {0};api = {0}{...}

Import From Network

Summery

Import an image from network

Description

Request and import an image at network address.

Example

address = {https://picsum.photos/200/300}{...}

Convert From Array Along Columns

Summery

Convert from array column-by-column

Description

Make an image from array x by filling columns of size h one pixel after another. The rest of the image is filled with color if needed. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {255,0,0,255, 0,255,0,255, 0,0,255,255};h = {2};color = {160,192,116,255}{...}

Convert From Array Along Rows

Summery

Convert from array row-by-row

Description

Make an image from array x by filling rows of size w one pixel after another. The rest of the image is filled with color if needed. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {255,0,0,255, 0,255,0,255, 0,0,255,255};w = {2};color = {160,192,116,255}{...}

Convert From Matrix

Summery

Convert from matrix

Description

Make an image from matrix x. The color channels of a pixel are computed as r×x+r_shift for red channel, g×x+g_shift for green channel, b×x+b_shift for blue channel, and a×x+a_shift for alpha channel, where x is the corresponding matrix element.

Example

x = {1,2,6;2,4,0;6,0,2};r = {160/4};r_shift = {0};g = {192/4};g_shift = {0};b = {116/4};b_shift = {0};a = {0};a_shift = {255}{...}

OpenAI - Image Generation

Summery

Generate an image using OpenAI API (third party)

Description

Make a w×h image with a prompt using OpenAI API and authorized by an api key.

Notes:

  1. To acquire an api key, go to https://platform.openai.com.
  2. To learn more about the api parameters, go to https://platform.openai.com/docs/api-reference/images/create.
  3. This plan requests data from OpenAI servers by sharing the plan parameters. Terms of Use for OpenAI is available at https://openai.com/policies/terms-of-use.
  4. Network timeout (Settings/Connection Timeout) may need to be raised to allow enough time for API response to arrive.
  5. Plan to generate the complete API response is available under Text Plans/Get/Response of Third-Party API.

Example

w = {1024};h = {1024};prompt = {A photograph of a fancy cat with a hat.};api key = {...}{...}

Plans to Reorganize an Image


Copy

Summery

Copy image

Description

Copy pixels of image x.

Example

x = {circle(20,blue)}{...}

Resize

Summery

Resize image

Description

Resize image x, without scaling, to w×h by cutting or filling with row r and column c. If there are not enough values available in r or c, the last color is repeated. When w or h is not provided, its value is preserved. When new columns and rows overlap, the overlapping pixel colors are blended.

Example

x = {circle(20,blue)};w = {10};c = {160,192,116,255}{...}
x = {circle(20,blue)};w = {25};c = {160,192,116,255}{...}
x = {circle(20,blue)};h = {10};r = {160,192,116,255}{...}
x = {circle(20,blue)};h = {25};r = {160,192,116,255}{...}
x = {circle(20,blue)};w = {10};h = {25};r = {160,192,116,255};c = {160,192,116,255}{...}
x = {circle(20,blue)};w = {25};h = {25};r = {160,192,116,255};c = {160,192,116,255}{...}

Replicate Columns

Summery

Replicate image in width

Description

Replicate image x in width by repeating each column p times and the resulting image q times column-by-column.

Example

x = {circle(20,blue)};p = {2};q = {3}{...}

Replicate Rows

Summery

Replicate image in height

Description

Replicate image x in height by repeating each row p times and the resulting image q times row-by-row.

Example

x = {circle(20,blue)};p = {2};q = {3}{...}

Mirror Horizontally (About Vertical Axis)

Summery

Mirror image horizontally (about vertical axis)

Description

Mirror image x horizontally so that rows are reversed.

Example

x = {line(10,20,black)}{...}
x = {flower(100,100)}{...}

Mirror Vertically (About Horizontal Axis)

Summery

Mirror image vertically (about horizontal axis)

Description

Mirror image x vertically so that columns are reversed.

Example

x = {line(10,20,black)}{...}
x = {flower(100,100)}{...}

Mirror Diagonally (About Off-Diagonal Axis)

Summery

Mirror image diagonally (about main skew diagonal)

Description

Mirror image x diagonally so that the diagonals (from upper left to lower right) of a square image are reversed.

Example

x = {line(10,20,black)}{...}
x = {flower(100,100)}{...}

Mirror Off-Diagonally (About Diagonal Axis)

Summery

Mirror image off-diagonally (about main diagonal)

Description

Mirror image x off-diagonally so that the skew diagonals (from upper right to lower left) of a square image are reversed.

Example

x = {line(10,20,black)}{...}
x = {flower(100,100)}{...}

Rotate +90°

Summery

Rotate image by +90° (90°CCW)

Description

Rotate image x by 90° counter-clockwise by moving the upper right corner pixel to upper left corner and so on.

Example

x = {line(10,20,black)}{...}
x = {flower(100,100)}{...}

Rotate -90°

Summery

Rotate image by -90° (90°CW)

Description

Rotate image x by 90° clockwise by moving the upper right corner pixel to lower right corner and so on.

Example

x = {line(10,20,black)}{...}
x = {flower(100,100)}{...}

Rotate 180°

Summery

Rotate image by 180°

Description

Rotate image x by 180° by moving the upper right corner pixel to lower left corner and so on.

Example

x = {line(10,20,black)}{...}
x = {flower(100,100)}{...}

Crop From Top Left

Summery

Crop image from top left

Description

Carve a w×h image out of image x starting from column x0 and row y0 counted from upper left corner.

Example

x = {line(10,20,black)};w = {8};h = {20};x0 = {3};y0 = {0}{...}
x = {flower(100,100)};w = {80};h = {50};x0 = {20};y0 = {50}{...}

Crop From Top Right

Summery

Crop image from top right

Description

Carve a w×h image out of image x starting from column x0 and row y0 counted from upper right corner.

Example

x = {line(10,20,black)};w = {8};h = {20};x0 = {3};y0 = {0}{...}
x = {flower(100,100)};w = {80};h = {50};x0 = {20};y0 = {50}{...}

Crop From Bottom Left

Summery

Crop image from bottom left

Description

Carve a w×h image out of image x starting from column x0 and row y0 counted from lower left corner.

Example

x = {line(10,20,black)};w = {8};h = {20};x0 = {3};y0 = {0}{...}
x = {flower(100,100)};w = {80};h = {50};x0 = {20};y0 = {50}{...}

Crop From Bottom Right

Summery

Crop image from bottom right

Description

Carve a w×h image out of image x starting from column x0 and row y0 counted from lower right corner.

Example

x = {line(10,20,black)};w = {8};h = {20};x0 = {3};y0 = {0}{...}
x = {flower(100,100)};w = {80};h = {50};x0 = {20};y0 = {50}{...}

Crop From Center

Summery

Crop image from center

Description

Carve a w×h image out of image x with a gap of x0 columns and y0 rows between centers. x0 = y0 = 0 centers the cropped image, x0 >0 shifts the cropped image rightward, and y0 >0 shifts it downward.

Example

x = {line(10,20,black)};w = {8};h = {20};x0 = {3};y0 = {0}{...}
x = {flower(100,100)};w = {80};h = {50};x0 = {20};y0 = {50}{...}

Swap Pixels

Summery

Swap image pixels

Description

Swap pixels at coordinates (x1, y1) with pixels at coordinates (x2, y2) in image x. Pixel at coordinates (x1[k], y1[k]) and pixel at coordinates (x2[k], y2[k]) are swapped with one another for each k starting from k = 0.

Example

x = {line(10,20,black)};x1 = {1,2,3};y1 = {0,1,2};x2 = {0,1,2};y2 = {1,2,3}{...}

Swap Columns

Summery

Swap image columns

Description

Swap pixels in columns x1 with pixels in columns x2 in image x. Columns x1[k] and x2[k] are swapped with one another for each k starting from k = 0.

Example

x = {line(10,20,black)};x1 = {1,2,3};x2 = {0,1,2}{...}

Swap rows

Summery

Swap image rows

Description

Swap pixels in rows y1 with pixels in rows y2 in image x. Rows y1[k] and y2[k] are swapped with one another for each k starting from k = 0.

Example

x = {line(10,20,black)};y1 = {1,2,3};y2 = {0,1,2}{...}

Insert Columns From Left

Summery

Insert columns with column numbers counted from left

Description

Insert n[k] copies of array c as {R,G,B,A} of pixels in column x0[k] counted from left for each k. If there are not enough values available in c, the last color is repeated. Similarly, if n does not have enough values, its last value is repeated.

Example

x = {line(10,20,black)};x0 = {0,2,3};n = {2,1};c = {160,192,116,255}{...}

Insert Columns From Right

Summery

Insert columns with column numbers counted from right

Description

Insert n[k] copies of array c as {R,G,B,A} of pixels in column x0[k] counted from right for each k. If there are not enough values available in c, the last color is repeated. Similarly, if n does not have enough values, its last value is repeated.

Example

x = {line(10,20,black)};x0 = {0,2,3};n = {2,1};c = {160,192,116,255}{...}

Insert Rows From Top

Summery

Insert rows with row numbers counted from top

Description

Insert n[k] copies of array r as {R,G,B,A} of pixels in row y0[k] counted from top for each k. If there are not enough values available in r, the last color is repeated. Similarly, if n does not have enough values, its last value is repeated.

Example

x = {line(10,20,black)};y0 = {0,2,3};n = {2,1};r = {160,192,116,255}{...}

Insert Rows From Bottom

Summery

Insert rows with row numbers counted from bottom

Description

Insert n[k] copies of array r as {R,G,B,A} of pixels in row y0[k] counted from bottom for each k. If there are not enough values available in r, the last color is repeated. Similarly, if n does not have enough values, its last value is repeated.

Example

x = {line(10,20,black)};y0 = {0,2,3};n = {2,1};r = {160,192,116,255}{...}

Remove Columns From Left

Summery

Remove columns with column numbers counted from left

Description

Remove n[k] columns starting from x0[k] counted from left for each k.

Example

x = {line(10,20,black)};x0 = {2,0};n = {3,1}{...}

Remove Columns From Right

Summery

Remove columns with column numbers counted from right

Description

Remove n[k] columns starting from x0[k] counted from right for each k.

Example

x = {line(10,20,black)};x0 = {2,0};n = {3,1}{...}

Remove Rows From Top

Summery

Remove rows with row numbers counted from top

Description

Remove n[k] rows starting from y0[k] counted from top for each k.

Example

x = {line(10,20,black)};y0 = {2,0};n = {3,1}{...}

Remove Rows From Bottom

Summery

Remove rows with row numbers counted from bottom

Description

Remove n[k] rows starting from y0[k] counted from bottom for each k.

Example

x = {line(10,20,black)};y0 = {2,0};n = {3,1}{...}

Trim Sides (by Color)

Summery

Trim all sides with color

Description

Remove columns and rows from four sides of image x so long as every pixel is the same color as color.

Example

x = {flower(100,100)};color = {0,0,0,0}{...}
x = {box(100,100,black)};color = {0,0,0,255}{...}

Trim Left (by Color)

Summery

Trim left side with color

Description

Remove columns from the left side of image x so long as every pixel is the same color as color.

Example

x = {flower(100,100)};color = {0,0,0,0}{...}
x = {box(100,100,black)};color = {0,0,0,255}{...}

Trim Right (by Color)

Summery

Trim right side with color

Description

Remove columns from the right side of image x so long as every pixel is the same color as color.

Example

x = {flower(100,100)};color = {0,0,0,0}{...}
x = {box(100,100,black)};color = {0,0,0,255}{...}

Trim Top (by Color)

Summery

Trim upper side with color

Description

Remove rows from the upper side of image x so long as every pixel is the same color as color.

Example

x = {flower(100,100)};color = {0,0,0,0}{...}
x = {box(100,100,black)};color = {0,0,0,255}{...}

Trim Bottom (by Color)

Summery

Trim lower side with color

Description

Remove rows from the lower side of image x so long as every pixel is the same color as color.

Example

x = {flower(100,100)};color = {0,0,0,0}{...}
x = {box(100,100,black)};color = {0,0,0,255}{...}

Trim Sides (by Top Left Color)

Summery

Trim all sides with color of upper left corner

Description

Remove columns and rows from four sides of image x so long as every pixel is the same color as the upper left corner.

Example

x = {flower(100,100)}{...}
x = {box(100,100,black)}{...}

Trim Sides (by Top Right Color)

Summery

Trim all sides with color of upper right corner

Description

Remove columns and rows from four sides of image x so long as every pixel is the same color as the upper right corner.

Example

x = {flower(100,100)}{...}
x = {box(100,100,black)}{...}

Trim Sides (by Bottom Left Color)

Summery

Trim all sides with color of lower left corner

Description

Remove columns and rows from four sides of image x so long as every pixel is the same color as the lower left corner.

Example

x = {flower(100,100)}{...}
x = {box(100,100,black)}{...}

Trim Sides (by Bottom Right Color)

Summery

Trim all sides with color of lower right corner

Description

Remove columns and rows from four sides of image x so long as every pixel is the same color as the lower right corner.

Example

x = {flower(100,100)}{...}
x = {box(100,100,black)}{...}

Plans to Reorganize Across Images


Copy the Nth Image

Summery

Copy an image

Description

Copy pixels of the nth image.

Example

x0 = {line(10,20,black)};x1 = {flower(100,100)};x1 = {circle(50,blue)};n = {1}{...}

Copy the First Non-Empty Image

Summery

Copy the first non-empty image

Description

Copy pixels of the first non-empty image between x0,x1,... . This plan does not cascade refresh requests to its parameters x0,x1,... .

Example

x0 = {};x1 = {};x2 = {line(10,20,black)};x3 = {flower(100,100)}{...}

Stitch Images in a Column

Summery

Stitch images in a column (vertically)

Description

Stitch images x0,x1,... side-by-side in a column (vertically) and fill the gaps with color when image widths are different.

Example

color = {160,192,116,255};x0 = {line(10,20,black)};x1 = {line(10,-20,black)}{...}

Stitch Images in a Row

Summery

Stitch images in a row (horizontally)

Description

Stitch images x0,x1,... side-by-side in a row (horizontally) and fill the gaps with color when image heights are different.

Example

color = {160,192,116,255};x0 = {line(10,20,black)};x1 = {line(10,-20,black)}{...}

Stitch Images in a Collage Image

Summery

Stitch images in a collage image

Description

Stitch images x0,x1,... side-by-side in a collage image and fill the gaps with color. Image x0 is located at row i[0] and column j[0] of the collage image, image x1 is located at row i[1] and column j[1] of the collage image, and so on.

Example

color = {160,192,116,255};i = {0,1,1};j = {0,0,1}x0 = {line(10,20,black)};x1 = {line(10,-20,black)};x2 = {flower(100,100)}{...}

Plans to Make an Image


Set Pixels

Summery

Set pixel colors

Description

Paint pixels of image x at coordinates (x0, y0) with color. Pixel at coordinates (x0[k], y0[k]) is painted with color[k] for each k. If there are not enough values available in color, the last color is repeated.

Example

x = {box(10,10,black)};x0 = {1,2,3};y0 = {0,1,2};color = {160,192,116,255}{...}

Set Columns From Left

Summery

Set columns with column numbers counted from left

Description

Set array c as {R,G,B,A} of pixels in column x0[k] counted from left for each k. If there are not enough values available in c, the last color is repeated.

Example

x = {line(10,20,black)};x0 = {0,2,3};c = {160,192,116,255}{...}

Set Columns From Right

Summery

Set columns with column numbers counted from right

Description

Set array c as {R,G,B,A} of pixels in column x0[k] counted from right for each k. If there are not enough values available in c, the last color is repeated.

Example

x = {line(10,20,black)};x0 = {0,2,3};c = {160,192,116,255}{...}

Set Rows From Top

Summery

Set rows with rows numbers counted from top

Description

Set array r as {R,G,B,A} of pixels in row y0[k] counted from top for each k. If there are not enough values available in r, the last color is repeated.

Example

x = {line(10,20,black)};y0 = {0,2,3};r = {160,192,116,255}{...}

Set Rows From Bottom

Summery

Set rows with rows numbers counted from bottom

Description

Set array r as {R,G,B,A} of pixels in row y0[k] counted from bottom for each k. If there are not enough values available in r, the last color is repeated.

Example

x = {line(10,20,black)};y0 = {0,2,3};r = {160,192,116,255}{...}

Color General Expression

Summery

Set color channels with expression

Description

Set color channels of pixels in image x with expressions r(r,g,b,a,x,y) for red channel, g(r,g,b,a,x,y) for green channel, b(r,g,b,a,x,y) for blue channel, and a(r,g,b,a,x,y) for alpha channel. Expressions r, g, b, and a are functions of pixel colors r,g,b,a, and pixel coordinates x and y. After evaluation, expression results are bounded in [0,255].

Expression parser supports the following:

  • Arithmetic operations: addition (+), subtraction/negation (-), multiplication (*), division (/), exponentiation (^) and modulus (%)
  • Numerical operations: sign, abs, ceil, floor, trunc, round, erf, sinc
  • Exponentiation operations: exp, pow, sqrt, logistic, logit
  • Combinatorial operations: fac, ncr, npr
  • Logarithmic operations: exp, ln (natural logarithm), log (base-10 logarithm), log10
  • Trigonometric functions: sin, cos, tan, cot, sec, csc, asin, acos, atan, atan2, acot, asec, acsc
  • Hyperbolic functions: sinh, cosh, tanh, coth, sech, csch, asinh, acosh, atanh, acoth, asech, acsch
  • Conditional operations: clamp, clean, disc, replace, replaceri, replacerx
  • Constants: pi, e

Example

x = {flower(100,100)};r = {r+50*cos(0.1*x*y)};g = {g+50*cos(0.1*x*y)};b = {b+50*cos(0.1*x*y)};a = {a}{...}

Set Colors

Summery

Set color channels

Description

Set color channels of pixels in image x to r, g, b, and a. If empty, the channel is preserved.

Example

x = {flower(100,100)};r = {100};g = {};b = {};a = {}{...}

Clamp Colors

Summery

Limit color channels

Description

Limit color channels of pixels in image x to [r_min, r_max] for red channel, [g_min, g_max] for green channel, [b_min, b_max] for blue channel, and [a_min, a_max] for alpha channel.

Example

x = {flower(100,100)};r_min = {100};r_max = {200};g_min = {0};g_max = {255};b_min = {0};b_max = {255};a_min = {0};a_max = {150}{...}

Scale Colors Linearly

Summery

Shift and scale color channels

Description

Shift and, then, linearly scale color channels of pixels in image x. New colors for a pixel with colors r,g,b,a are computed as r(r+shift_r) for red channel, g(g+shift_g) for green channel, b(b+shift_b) for blue channel, and a(a+shift_a) for alpha channel.

Example

x = {flower(100,100)};r_shift = {0};r = {1.2};g_shift = {0};g = {1};b_shift = {0};b = {1};a_shift = {-50};a = {1}{...}

Scale Colors Linearly to Limits

Summery

Scale color channels linearly toward limits

Description

Scale color channels of pixels in image x linearly toward the limits (0 and 255) by factor r for red channel, g for green channel, b for blue channel, and a for alpha channel. A factor of 0 maintains a color channel, +1 saturates it at 255 and -1 saturates it at 0.

Example

x = {flower(100,100)};r = {1};g = {0};b = {0};a = {0}{...}

Scale Colors Logarithmically to Limits

Summery

Scale color channels logarithmically toward limits

Description

Scale color channel of pixels in image x logarithmically toward the limits (0 and 255) by factor r for red channel, g for green channel, b for blue channel, and a for alpha channel. A factor of 0 maintains a color channel, +∞ saturates it at 255 and -∞ saturates it at 0.

Example

x = {flower(100,100)};r = {1};g = {0};b = {0};a = {0}{...}

Translate

Summery

Translate image

Description

Translate image x horizontally by dx and vertically by dy.

Example

x = {flower(100,90)};dx = {10};dy = {-20}{...}

Scale

Summery

Scale image

Description

Scale image x horizontally by sx and vertically by sy.

Example

x = {flower(100,90)};sx = {1.2};sy = {0.7}{...}

Rotate

Summery

Rotate image

Description

Rotate image x by angle in degrees. Positive angle is counter-clockwise.

Example

x = {flower(100,90)};angle = {-45}{...}

Shear

Summery

Shear image

Description

Shear image x horizontally by sx and vertically by sy.

Example

x = {flower(100,90)};sx = {0.5};sy = {0.2}{...}

Transform

Summery

Transform image

Description

Transform image x by transformation array t = {t11,t12,t13,t21,t22,t23,t31,t32,t33}. t31 and t32 specify horizontal and vertical translations, t11 and t22 specify horizontal and vertical scaling, and t21 and t12 specify horizontal and vertical shearing. Finally, t13 and t23 specify horizontal and vertical projections, with t33 as an additional projection factor.

Example

x = {flower(100,90)};t = {1,0.2,0,0.5,1,0,0,0,1}{...}

Mirror Horizontally and Rotate

Summery

Rotate horizontally-mirrored image

Description

Horizontally (about vertical axis) mirror image x and, then, rotate by angle in degrees. Positive angle is counter-clockwise.

Example

x = {flower(100,90)};angle = {-45}{...}

Mirror Vertically and Rotate

Summery

Rotate vertically-mirrored image

Description

Vertically (about horizontal axis) mirror image x and, then, rotate by angle in degrees. Positive angle is counter-clockwise.

Example

x = {flower(100,90)};angle = {-45}{...}

Resize by Scaling (Fixed Aspect Ratio)

Summery

Resize and scale image with fixed aspect ratio

Description

Stretch or shrink image x to w×h. When a dimension is not provided (empty), the aspect ratio is preserved.

Example

x = {flower(100,90)};w = {200}{...}
x = {flower(100,90)};h = {200}{...}

Resize by Scaling

Summery

Resize an scale image

Description

Stretch or shrink image x to w×h. When a dimension is not provided (empty), it is preserved.

Example

x = {flower(100,90)};w = {200}{...}
x = {flower(100,90)};h = {200}{...}

Blur

Summery

Apply Gaussian blur

Description

Apply Gaussian blur to image x with a w×h kernel (aperture). w and h are rounded to the nearest positive odd number.

Example

x = {flower(100,90)};w = {3};h = {3}{...}
x = {flower(100,90)};w = {11};h = {1}{...}

OpenAI - Image Edit

Summery

Edit an image using OpenAI API (third party)

Description

Edit image x to a new image by changing a masked area, described by transparent areas in image mask, with a prompt using OpenAI API and authorized by an api key. Mask is resized by adding transparent rows and columns to match the size of image x.

Notes:

  1. To acquire an api key, go to https://platform.openai.com.
  2. To learn more about the api parameters, go to https://platform.openai.com/docs/api-reference/images/createEdit.
  3. This plan requests data from OpenAI servers by sharing the plan parameters. Terms of Use for OpenAI is available at https://openai.com/policies/terms-of-use.
  4. Network timeout (Settings/Connection Timeout) may need to be raised to allow enough time for API response to arrive.
  5. Plan to generate the complete API response is available under Text Plans/Get/Response of Third-Party API.

Example

x = {flower(512,512)};mask = {circle(200,white)};prompt = {A flower with fiery corners.};api key = {...}{...}

OpenAI - Image Variation

Summery

Make an image variation using OpenAI API (third party)

Description

Make a variation of image x using OpenAI API and authorized by an api key.

Notes:

  1. To acquire an api key, go to https://platform.openai.com.
  2. To learn more about the api parameters, go to https://platform.openai.com/docs/api-reference/images/createVariation.
  3. This plan requests data from OpenAI servers by sharing the plan parameters. Terms of Use for OpenAI is available at https://openai.com/policies/terms-of-use.
  4. Network timeout (Settings/Connection Timeout) may need to be raised to allow enough time for API response to arrive.
  5. Plan to generate the complete API response is available under Text Plans/Get/Response of Third-Party API.

Example

x = {flower(512,512)};api key = {...}{...}

Plans to Make Across Images


Alpha Blend

Summery

Alpha blend images

Description

Alpha blend images x0, x1,... over one another.

Example

x0 = {flower(100,90)};x1 = {box(30,40,green)};x2 = {line(90,-50,yellow)}{...}
x0 = {box(100,100,transparent)};x1 = {box(20,20,white)};x2 = {circle(100,cyan)};x3 = {flower(100,100)}{...}

Combine (Average of Colors)

Summery

Combine images by averaging color channels

Description

Combine images x0, x1,... by averaging rgb color channels and maximizing alpha channel across the images.

Example

x0 = {flower(100,90)};x1 = {box(30,40,green)};x2 = {line(90,-50,yellow)}{...}
x0 = {box(100,100,transparent)};x1 = {box(20,20,white)};x2 = {circle(100,cyan)};x3 = {flower(100,100)}{...}

Combine (Weighted Average of Colors)

Summery

Combine images by averaging weighted color channels

Description

Combine images x0, x1,... by averaging weighted rgb color channels and maximizing alpha channel across the images. Red, green, and blue channel weights are provided in arrays r, g, and b so that the red channel in x0 is weighted by r[0] and so on.

Example

r = {2,1,1};g = {2,1,1};b = {2,1,1};x0 = {flower(100,90)};x1 = {box(30,40,green)};x2 = {line(90,-50,yellow)}{...}
r = {1,1,1,5};g = {1,1,1,5};b = {1,1,1,1};x0 = {box(100,100,transparent)};x1 = {box(20,20,white)};x2 = {circle(100,cyan)};x3 = {flower(100,100)}{...}

Plans to Derive From an Image


W - Image Width

Summery

Count image columns

Description

Count columns, that is w or the width, in image x.

Example

x = {line(100,50,blue)}{100}

H - Image Height

Summery

Count image rows

Description

Count rows, that is h or the height, in image x.

Example

x = {line(100,50,blue)}{50}

Copy Pixels

Summery

Copy image pixels

Description

Copy image pixels at coordinates (px[k], py[k]) for each k. If the sizes of arrays px and py are different, the last value in the smaller array is repeated. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {line(100,50,blue)};px = {10,20,5};py = {5,10,12}{0,0,255,255, 0,0,255,255, 0,0,0,0}

Copy Columns

Summery

Copy image columns

Description

Copy image columns px[k] one column after another for each k. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {line(2,2,blue)};px = {0}{0,0,255,255, 0,0,255,211}

Copy Rows

Summery

Copy image rows

Description

Copy image rows py[k] one row after another for each k. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {line(2,2,blue)};py = {0}{0,0,255,255, 0,0,255,211}

Copy and Shuffle Columns

Summery

Copy image columns staggered

Description

Copy image columns px[k] along rows (staggered) for each k. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {line(2,2,blue)};px = {1}{0,0,255,211, 0,0,255,255}

Copy and Shuffle Rows

Summery

Copy image rows staggered

Description

Copy image rows py[k] along columns (staggered) for each k. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {line(2,2,blue)};py = {1}{0,0,255,211, 0,0,255,255}

Copy All Column

Summery

Copy all image columns

Description

Copy image x column-by-column. This effectively converts an image to an array. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {line(2,2,blue)}{0,0,255,255, 0,0,255,211, 0,0,255,211, 0,0,255,255}

Copy All Rows

Summery

Copy all image rows

Description

Copy image x row-by-row. This effectively converts an image to an array. Pixels are specified as four consecutive values in 0 to 255 range for RGBA color channels.

Example

x = {line(2,2,blue)}{0,0,255,255, 0,0,255,211, 0,0,255,211, 0,0,255,255}

Classification Bounds

Summery

Detect objects with a cascade classifier

Description

Detect objects in image x. If detected, the bounding rectangles are listed with the coordinates of their opposite corners p and q as {p1,x,p1,y,q1,x,q1,y,p2,x,... }. file name is the classifier file address. In detection process, a valid object rectangle must have n candidate neighbors and in each pass, the detection window is enlarged by scale factor.

Example

x = {...};file name = {tests\haarcascade_frontalface_alt.xml};n = {3};scale = {1.1}{...}

Plans to Derive Across Images


Plans to Post an Image


Export With Format Auto-Detect

Summery

Export an image with format auto-detect

Description

Export image x to file name with format auto-detect. When applicable, compression is controlled by a quality factor in the range of 0 to 100 or equal to -1 where 100 results in the most compression (smallest file), 0 in the least compressed (largest file), and -1 in the application of the default settings.

Example

file name = {tests\testimage.jpg};quality = {-1};x = {circle(200,blue)}

Export to BMP File

Summery

Export an image to BMP file

Description

Export image x to a Windows Bit Map (BMP) file at file name.

Example

file name = {tests\testimage.bmp};x = {circle(200,red)}

Export to JPG File

Summery

Export an image to JPG file

Description

Export image x to a Joint Photographic Experts Group (JPG) file at file name. Compression is controlled by a quality factor in the range of 0 to 100 or equal to -1 where 100 results in the most compression (smallest file), 0 in the least compressed (largest file), and -1 in the application of the default settings.

Example

file name = {tests\testimage.jpg};quality = {-1};x = {circle(200,blue)}

Export to PNG File

Summery

Export an image to PNG file

Description

Export image x to a Portable Network Graphics (PNG) file at file name. Compression is controlled by a quality factor in the range of 0 to 100 or equal to -1 where 100 results in the most compression (smallest file), 0 in the least compressed (largest file), and -1 in the application of the default settings.

Example

file name = {tests\testimage.png};quality = {-1};x = {circle(200,yellow)}

Export to PPM File

Summery

Export an image to PPM file

Description

Export image x to a Portable Pixel Map (PPM) file at file name.

Example

file name = {tests\testimage.ppm};x = {circle(200,gray)}

Export to XBM File

Summery

Export an image to XBM file

Description

Export image x to an X11 Bit Map (XBM) file at file name.

Example

file name = {tests\testimage.xbm};x = {circle(200,lightblue)}

Export to XPM File

Summery

Export an image to XPM file

Description

Export image x to an X11 Pixel Map (XPM) file at file name.

Example

file name = {tests\testimage.xpm};x = {circle(200,palegreen)}

Export to Video File

Summery

Export images to video file

Description

Export mages x0, x1, ... to a video file at file name. Fourcc is the 4-character code of the codec used to compress the frames and it can be specified by cccc. For example, PIM1 requests MPEG-1 codec, MJPG requests motion-jpeg codec, etc. api is the OpenCV VideoCapture api back-end identifier where api=0 auto detects the available back-end. fps is the frame rate of the video.

Example

file name = {tests\test.avi};cccc = {};api = {0};fps = {2};x0 = {circle(200,greenyellow)};x1 = {circle(200,lightgreen)};x2 = {circle(200,yellowgreen)};x3 = {circle(200,green)}