26 lines
654 B
Bash
26 lines
654 B
Bash
|
|
#!/bin/bash
|
||
|
|
# banner-to-dotmatrix.sh - Convert image to LQ-350 full-width ESC/P2 raster
|
||
|
|
|
||
|
|
INPUT_FILE="${1}"
|
||
|
|
OUTPUT_BIN="${INPUT_FILE%.*}-lq350.bin"
|
||
|
|
|
||
|
|
if [ -z "${INPUT_FILE}" ]; then
|
||
|
|
echo "Usage: ${0} input.jpg"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo ${INPUT_FILE}
|
||
|
|
echo ${OUTPUT_BIN}
|
||
|
|
|
||
|
|
convert ${INPUT_FILE} -resize 2650x -density 360x180 -monochrome -dither FloydSteinberg -compress none \
|
||
|
|
pbm:- | pbmtoescp2 -resolution=360 > "$OUTPUT_BIN"
|
||
|
|
|
||
|
|
# Optional: prepend ESC/P2 reset
|
||
|
|
printf '\x1B\x40' > init.bin
|
||
|
|
cat init.bin "$OUTPUT_BIN" > print-ready.bin
|
||
|
|
|
||
|
|
lp -d EPSON_LQ-350 -o raw print-ready.bin
|
||
|
|
|
||
|
|
# Clean up temp files (uncomment if desired)
|
||
|
|
# rm init.bin print-ready.bin
|