From a0796888f6badb3757bdf99ca1c7d72acb1fbf89 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 22 Nov 2023 19:00:05 +0100 Subject: [PATCH] Split out image formatting --- format_image.sh | 4 ++++ print_image.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100755 format_image.sh diff --git a/format_image.sh b/format_image.sh new file mode 100755 index 0000000..06b16e6 --- /dev/null +++ b/format_image.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +magick "$1"'[0]' -resize 512x1662\> -dither FloydSteinberg -remap pattern:gray50 pbm:- diff --git a/print_image.sh b/print_image.sh index 65744b6..1b14911 100755 --- a/print_image.sh +++ b/print_image.sh @@ -2,7 +2,7 @@ set -e dev=/dev/usb/lp0 -image="$(magick "$1"'[0]' -resize 512x1662\> -dither FloydSteinberg -remap pattern:gray50 pbm:- | base64)" +image="$(./format_image "$1" | base64)" data_header="$(echo "$image" | base64 -d | sed -n '2p')" data="$(echo "$image" | base64 -d | tail -n +3 | base64)"