Image

Function

Image(data, format)

data
format

The Image function dynamically creates an image from pixel data and a given pixel format.

Supported pixel formats (string values, not case sensitive) are:

  • BGRA
  • BGR
  • RGB
  • GRAY
  • SVG

For raster pixel formats, the data input may be an array of matrices for each color channel, or it may be a single buffer array. Also, it may be an SVG string for SVG format.

For example, the following formula defines an image dynamically from pixel values in a spreadsheet:

Library.Docs.Image([Sheet1.A1:H8, Sheet1.J1:Q8, Sheet1.S1:Z8], "RGB")

If the color channels are combined, as is the case for a NumPy array through Blockpad's Python integration, then the data can be given as a single value. See the example with Exec function.

Dynamic images may be given with image objects (When inserting an image, click Use Formula, then give formulas such as above.) or with equations, cells, or fields.


You can refer to this function in any formula, macro, module, or other script in Blockpad. You can use either its name or its full path:

  • To refer to it by name, use Image(...) (make sure the library Library.Docs is included with Include Libaries)
  • To refer to it by its full path, use Library.Docs.Image(...)

 

See also: