#!/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