commit 6b0eedee66b754dfa45dfa815f84f8ccab52ad36 parent 9544c5c8b606ba6ae814b1382826b2b447990887 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Tue, 20 Oct 2020 11:41:02 +0200 maim{full,pick}: perform lossless compression on png files with optipng(1) Diffstat:
M | .local/bin/maimfull | | | 6 | +++++- |
M | .local/bin/maimpick | | | 3 | +++ |
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/.local/bin/maimfull b/.local/bin/maimfull @@ -1,2 +1,6 @@ #!/bin/sh -maim ~/tmp/pic-full-$(date '+%y%m%d-%H%M-%S').png +f="${HOME}/tmp/pic-full-$(date '+%y%m%d-%H%M-%S').png" +maim "$f" +if command -v optipng >/dev/null 2>&1; then + optipng "$f" >/dev/null +fi diff --git a/.local/bin/maimpick b/.local/bin/maimpick @@ -49,6 +49,9 @@ post_process_output() out="$1" out_jpeg="${out%.png}.jpg" format="png" + if command -v optipng >/dev/null 2>&1; then + optipng "${out}" >/dev/null + fi convert "${out}" "${out_jpeg}" if [ "$(stat -f "%z" "${out_jpeg}")" -lt "$(stat -f "%z" "${out}")" ]; then format="jpeg"