#!/bin/sh font=${LP_FONT:-Courier} # Densities over 400 cause ImageMagick to cut off the top of the first line. density=400 # Leading whitespace causes ImageMagick to duplicate the first non-empty line. skip_leading_empty_lines() { perl -pe 'if (/./) {$seen++} elsif (!$seen) {undef $_}' } skip_leading_empty_lines | gm convert -font $font -density $density text:- -trim png:- | lp "$@"