|
@ -2,7 +2,7 @@ |
|
|
set -e |
|
|
set -e |
|
|
dev=/dev/usb/lp0 |
|
|
dev=/dev/usb/lp0 |
|
|
|
|
|
|
|
|
image="$(magick "$1" -resize 256x -dither FloydSteinberg -remap pattern:gray50 pbm:- | base64)" |
|
|
image="$(magick "$1" -resize 512x -dither FloydSteinberg -remap pattern:gray50 pbm:- | base64)" |
|
|
data_header="$(echo "$image" | base64 -d | sed -n '2p')" |
|
|
data_header="$(echo "$image" | base64 -d | sed -n '2p')" |
|
|
data="$(echo "$image" | base64 -d | tail -n +3 | base64)" |
|
|
data="$(echo "$image" | base64 -d | tail -n +3 | base64)" |
|
|
|
|
|
|
|
@ -18,15 +18,15 @@ size_y="$(hex_size "$(echo "$data_header" | cut -d' ' -f 2)")" |
|
|
# Upload graphics data |
|
|
# Upload graphics data |
|
|
printf '\x1D(L' > $dev |
|
|
printf '\x1D(L' > $dev |
|
|
printf "$size" > $dev |
|
|
printf "$size" > $dev |
|
|
printf '\x30\x70\x30' > $dev |
|
|
printf '0p0' > $dev |
|
|
printf '\x02\x02' > $dev # bx, by (1 or 2) |
|
|
printf '\1\1' > $dev # bx, by (1 or 2) |
|
|
printf '\x31' > $dev # color |
|
|
printf '1' > $dev # color |
|
|
printf "$size_x" > $dev # size x |
|
|
printf "$size_x" > $dev # size x |
|
|
printf "$size_y" > $dev # size y |
|
|
printf "$size_y" > $dev # size y |
|
|
echo "$data" | base64 -d > $dev |
|
|
echo "$data" | base64 -d > $dev |
|
|
|
|
|
|
|
|
# Print graphics data |
|
|
# Print graphics data |
|
|
printf '\x1D(L\x02\0\x30\x02' > $dev |
|
|
printf '\x1D(L\2\00002' > $dev |
|
|
|
|
|
|
|
|
# Cut paper |
|
|
# Cut paper |
|
|
printf '\n\n\x1DVA\0' > $dev |
|
|
printf '\n\n\n\x1DVA\0' > $dev |
|
|