Post

Freeze — Generate images from the otuput of your terminal

freeze cli to generate images of your terminal output

Freeze — Generate images from the otuput of your terminal

Introduction

charm

If you have not heard about charm you should definitely check out what they have.

The libraries and apps they have created the best good looking ones I have seen in a long time, they somehow have reinvented the way cli tools look like on the terminal, and for better.

freeze

freeze is one of the new cli tools they have created to generate images of code and terminal output

Similar to asciinema but focus on images, you can generate an image from the terminal and customize it as you wish. It is really mind blowing how good the images look.

Install

MacOS

Using homebrew

1
brew install charmbracelet/tap/freeze

Linux

Any Linux platform using go

1
go install github.com/charmbracelet/freeze@latest

Use

Generate Image from STDOUT

1
freeze --execute "ls -la"

Generate image from a code file

It will detect the language automatically

1
freeze config.fish

If you prefer you can set the language

1
cat bash_script.sh | freeze --language bash

Customize

There are many options to customise the ouput on freeze

  • margin, padding, window, width and height
  • border: radius, width and color
  • shadow: blur, x and y
  • font: family, file, size and ligatures
  • line-height, lines and show line numbers.

Interactive mode

The easiest way to customise freeze is by running the interactive mode

1
2
3
4
5
freeze --interactive bash_script.sh

# Changed

# Theme doom-one

Using flags

You can customise the output using flags too

1
freeze --theme doom-one bash_script.sh

Extras

Show line numbers

1
freeze --show-line-numbers bash_script.sh

Show only lines from X to Y

1
freeze --lines 2,5 --show-line-numbers bash_script.sh

Change the default freeze.png output file name and image type

You can generate svg, png or webp images

1
freeze bash_script.sh --output bash.svg
This post is licensed under CC BY 4.0 by the author.