A format for sending IRC bitmaps inline.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.8 KiB

irc-bitmap

A format for sending IRC bitmaps inline.

Format

The format string shall be (in Python syntax) r'<i([^-]+)-([^-]*-)(.*)'.

The first capture group shall be a format. The currently recognized formats are gb, r16, and r85, though any format can be used. A program SHOULD gracefully report and exit on an unknown or unsupported format. The identifier of a format may not include a hyphen (dash).

The second capture group (optional) shall be known as the header and its syntax shall be defined by the format, but if present it MUST contain exactly one hypen and it must be the last character in the header.

The third capture group contains the image data, shall be known as the payload, and is defined by the format.

Upon receiving a message containing the part, a compliant client MAY take steps to attempt a conversion to PNG or similar, or display the image inline. A thread with timeout CAN and SHOULD be used.

While there is no theoretical limit to the size of the image you can send, you are bound by any message length limits your server sets, as the entire part MUST fit in one message.

Recognized formats

gb - GameBoy 2BPP 4-shade monochrome

For an explanation of the format, see here.

The header has this syntax: r'(\d+).(\d+)-'. The first and second capture groups specify the width and height in 8x8 tiles.

The payload is a hexadecimal representation of the image data. It has this syntax: r'([0-9A-Fa-f]+)'.

Example line: <igb-1.1-FF007EFF858189839385A58BC9977EFF>
Results in:
Pokemon Red window

r16 - Raw arbitrary bitmaps, hexadecimal-encoded

The header has this syntax: r'(\d+).(\d+).(\d+)-'. The first and second capture groups specify the width and height of the image and the third group specifies the bitdepth.

The payload is a hexadecimal representation of the image data. It has this syntax: r'([0-9A-Fa-f]+)'.

8x8, monochrome

Example line: <irawhex-8.8.1-FF818181818181FF>
Results in:
box

ra85 - Raw arbitrary bitmaps, (Adobe) ascii85-encoded

The header has this syntax: r'(\d+).(\d+).(\d+)-'. The first and second capture groups specify the width and height of the image and the third group specifies the bitdepth.

The payload is an (Adobe) ascii85-encoded representation of the image data. It has this syntax: r'(<~[!-uz]+~>)'.

8x8, monochrome

See https://en.wikipedia.org/wiki/Ascii85#Example_for_Ascii85 for the encoding. See ruby-ascii85 package in Debian for an implementation. TODO: see https://www.dcode.fr/ascii-85-encoding for a non-Adobe implementation that will save at least four bytes.

Example line: <ira85-8.8.1-<~?t'(dJUrB'Jc>~>
Results in:
box