RLE (.rle)

Background & Context

    • Raster image format.
    • A very simple lossless data compression.
    • Compresses image data using run-length encoding.
    • Efficient in compressing black-and-white images.
    • Plain text format.
    • Superseded by other raster formats such as GIF.

Import & Export

  • Import["file.rle"] imports an RLE file, returning an Image object.
  • Import["file.rle",elem] imports the specified element from an RLE file.
  • The import format can be specified with Import["file","RLE"] or Import["file",{"RLE",elem,}].
  • Export["file.rle",expr] exports an image, graphics and numeric arrays to an RLE file.
  • Image objects are by default exported at their full raster size. Graphics and other arbitrary expressions are exported using the same raster size as their displayed form.
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "Array"initial state as a SparseArray object
    "Image"initial state as an Image object
  • Metadata elements:
  • "Comments"comments stored in the file
    "ImageSize"size of the imported raster
  • An RLE file may include additional images such as intermediate results of a cellular automaton evolution.
  • Elements to access additional data:
  • "ArrayList"list of SparseArray objects
    "FullData"a list of associations including "Rule", "Array" and "Comments" key-value pairs
    "ImageCount"total number of images stored in the file
    "ImageList"list of Image objects



open allclose all

Basic Examples  (1)

Import an RLE file:

Import an RLE image:

Scope  (2)

Plot data imported from an RLE file:

Export data to an RLE file:

Import Elements  (10)

Available Elements  (2)

List of available elements:

Import all elements as a list of rules:

Data Representation  (4)

"Array"  (1)

Import image data:

Construct the image using a proper type:

"ArrayList"  (1)

Import all the data stored in the file:

"Image"  (1)

Import image data stored in a file as an Image object:

"ImageList"  (1)

Import all the data stored in the file as Image objects:

Metadata Elements  (2)

"Comments"  (1)

Import comments stored in a file:

"ImageSize"  (1)

Import the dimensions of the image:

Additional Elements  (2)

"ImageCount"  (1)

Total number of images stored in the file:

"FullData"  (1)

A list of associations including rule, data and comments for each image stored in the file:

Export Options  (2)

"Rule"  (1)

Export data to a file:

Import the file back to see the full data:

Specify a custom rule on export:

"Comments"  (1)

By default, no comment is stored in the file:

Specify a custom rule on export: