#!/bin/sh # # txt2gif [-fmt] file # # Convert a plain text file into a GIF image for display on the IM Example # pages. The GIF image filename is exactly the same as the given input # filename but with a ".gif" suffix appended. # ### # Anthony Thyssen # IM Example settings common to all examples [ -f ./generate_options ] && . ./generate_options [ -f ../generate_options ] && . ../generate_options [ -f ../../generate_options ] && . ../../generate_options # TXT2GIF conversion if [ "X$1" = "X-fmt" ]; then shift fmt="fmt -s" else fmt="cat" fi expand "$1" | $fmt | # Expand tabs (and posibly reformat text) perl -0777 -pe 's/\n$//' | # Remove last newline from txt input #sed 's/\\/\\\\/g' | # Escape escapes -- removed IM v6.3.3 convert -font CourierNew -pointsize 12 \ -background "$txt_bg_color" label:@- \ -bordercolor "$txt_bg_color" -border 1 \ "$1.gif"