Skip to content

Instantly share code, notes, and snippets.

@talwrii
Created April 22, 2026 16:22
Show Gist options
  • Select an option

  • Save talwrii/08c45453759ebe8ff07fd06cbfc5e38e to your computer and use it in GitHub Desktop.

Select an option

Save talwrii/08c45453759ebe8ff07fd06cbfc5e38e to your computer and use it in GitHub Desktop.
printimg — work around CUPS silently dropping progressive (interlaced) JPEGs by re-encoding to baseline before printing
#!/bin/bash
# printimg - print any image, re-encoding JPEGs to baseline to dodge CUPS issues
set -e
if [ -z "$1" ]; then
echo "Usage: printimg <image> [lpr options...]" >&2
exit 1
fi
input="$1"
shift
tmp=$(mktemp --suffix=.jpg)
trap 'rm -f "$tmp"' EXIT
convert "$input" -interlace none "$tmp"
lpr -o fit-to-page -o media=A4 "$@" "$tmp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment