Terminal

Terminal has support for two formats for embedding images in shell output: a URL-based format (escape code 1338) and the iTerm inline image format (escape code 1337).

URL-based Inline Images

Terminal supports embedding images by pointing to the URLs source, rather than just embedded via base64 encoding. In Terminal’s case the images are rendered to <img> tags.

There are four properties: url, alt, width and height; all case insensitive.


Bash function that prints the correctly formatted image output
function print_image_ref { printf '\033]1338;url='"$1"';alt='"$2"'\a\n'; }
You can use it like so:
print_image_ref "http://media.giphy.com/media/wzCVIrkDwNAuk/giphy.gif" "OMG"
The result!
OMG


There is no limit or filter on the URLs allowed, it is up to the client to interpret or sanitize them as necessary. For example Buildkite lets you refer to build artifacts using the custom URL scheme artifact:// and disallows relative (protocol-less) URLs.

The height and height properties can be defined as px or % values, for example width=50px or width=100%.

The alt property should be specified for every image, and describes the content of the image.

Embedded Inline Images

The support for embedded images follows iTerm’s inline image format. This format allows you to embed an image using base64 encoding.

Terminal requires you to specify inline=1 and a name. The preserveAspectRatio property is not supported and will be ignored.