dank-dithering/color_palette_dither.sh
2022-01-05 23:58:56 +01:00

22 lines
548 B
Bash

#!/bin/sh
img=$1
palette=$2
colors=$(cat $palette)
COUNTER=1
magick convert "$img" -fuzz 99% -fill black +opaque white -fill black -opaque white /tmp/img_out_d0.png
for color in $colors
do
echo "Creating image with counter ${COUNTER}."
./get_color_part.sh "$img" "$color" "7c${COUNTER}"
magick composite -compose plus \
"/tmp/img_out_d$((COUNTER-1)).png" \
"img_out_${color}.png" \
"/tmp/img_out_d$((COUNTER)).png"
COUNTER=$((COUNTER+1))
done
magick convert "/tmp/img_out_d$((COUNTER-1)).png" img_out_dithered_full.gif