diff --git a/color_palette.txt b/color_palette.txt new file mode 100644 index 0000000..22833c3 --- /dev/null +++ b/color_palette.txt @@ -0,0 +1,6 @@ +red +orange +yellow +pink +green +SaddleBrown diff --git a/color_palette_dither.sh b/color_palette_dither.sh new file mode 100644 index 0000000..dd8e9e2 --- /dev/null +++ b/color_palette_dither.sh @@ -0,0 +1,22 @@ +#!/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 diff --git a/color_palette_sky.txt b/color_palette_sky.txt new file mode 100644 index 0000000..5a27757 --- /dev/null +++ b/color_palette_sky.txt @@ -0,0 +1,6 @@ +RoyalBlue +blue4 +CornflowerBlue +pink +orange +wheat diff --git a/get_color_part.sh b/get_color_part.sh new file mode 100644 index 0000000..022f0bf --- /dev/null +++ b/get_color_part.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +img=$1 +color=$2 +dither=$3 + +magick convert "$img" -fuzz 30% -fill black +opaque "$color" -fill white -opaque "$color" /tmp/img_block.png +magick convert "$img" -fuzz 1% -fill black +opaque white -fill white -opaque white /tmp/img_white_block.png +magick composite /tmp/img_block.png -compose add /tmp/img_white_block.png /tmp/img_full_block.png +magick convert "$img" -fuzz 100% -fill "$color" -opaque "$color" /tmp/img_col.png +magick composite "$img" -compose difference /tmp/img_col.png /tmp/img_diff.png +magick convert /tmp/img_diff.png -set colorspace Gray -separate -average -negate /tmp/img_mask.png +magick composite /tmp/img_mask.png -compose multiply /tmp/img_full_block.png /tmp/img_val.png +magick convert /tmp/img_val.png -negate -ordered-dither "$dither" -negate /tmp/img_val_dithered.png +magick composite /tmp/img_val_dithered.png -compose multiply /tmp/img_col.png img_out_"$color".png diff --git a/thresholds.xml b/thresholds.xml new file mode 100644 index 0000000..004ebfb --- /dev/null +++ b/thresholds.xml @@ -0,0 +1,239 @@ + + + + + + + + + +]> + + + + + Horizontal lines 2x2 + + 3 3 + 9 9 + + + + + Vertical lines 2x2 + + 9 9 + 3 3 + + + + + Diagonal lines 2x2 + + 9 3 + 3 9 + + + + + 7-color non-mixing dither, color one boolean + + 1 0 1 0 1 0 1 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 0 1 0 1 0 1 0 1 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 1 0 1 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + + + + + 7-color non-mixing dither, color two boolean + + 0 0 0 0 0 0 0 0 + 0 1 0 1 0 1 0 1 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 1 0 1 0 1 0 1 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 + + + + + 7-color non-mixing dither, color three boolean + + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 1 0 1 0 1 0 1 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 0 1 0 1 0 1 0 1 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 1 + + + + + 7-color non-mixing dither, color four boolean + + 0 1 0 0 0 0 0 0 + 0 0 1 0 0 0 0 0 + 0 0 0 1 0 0 0 0 + 0 0 0 0 1 0 0 0 + 0 0 0 0 0 1 0 0 + 0 0 0 0 0 0 1 0 + 0 0 0 0 0 0 0 1 + 1 0 0 0 0 0 0 0 + + + + + 7-color non-mixing dither, color five boolean + + 0 0 0 1 0 0 0 0 + 0 0 0 0 1 0 0 0 + 0 0 0 0 0 1 0 0 + 0 0 0 0 0 0 1 0 + 0 0 0 0 0 0 0 1 + 1 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 + 0 0 1 0 0 0 0 0 + + + + + 7-color non-mixing dither, color six boolean + + 0 0 0 0 0 1 0 0 + 0 0 0 0 0 0 1 0 + 0 0 0 0 0 0 0 1 + 1 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 + 0 0 1 0 0 0 0 0 + 0 0 0 1 0 0 0 0 + 0 0 0 0 1 0 0 0 + + + + + 7-color non-mixing dither, color seven boolean + + 0 0 0 0 0 0 0 1 + 1 0 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 + 0 0 1 0 0 0 0 0 + 0 0 0 1 0 0 0 0 + 0 0 0 0 1 0 0 0 + 0 0 0 0 0 1 0 0 + 0 0 0 0 0 0 1 0 + + + + + + 7-color non-mixing dither, color one + + 1 0 2 0 1 0 2 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 0 3 0 4 0 3 0 4 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 3 0 4 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + + + + + 7-color non-mixing dither, color two + + 0 0 0 0 0 0 0 0 + 0 1 0 2 0 1 0 2 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 3 0 4 0 3 0 4 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 0 3 0 0 0 0 0 0 + + + + + 7-color non-mixing dither, color three + + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 1 0 2 0 1 0 2 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 + 0 3 0 4 0 3 0 4 + 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 3 + + + + + 7-color non-mixing dither, color four + + 0 1 0 0 0 0 0 0 + 0 0 2 0 0 0 0 0 + 0 0 0 3 0 0 0 0 + 0 0 0 0 4 0 0 0 + 0 0 0 0 0 1 0 0 + 0 0 0 0 0 0 2 0 + 0 0 0 0 0 0 0 3 + 4 0 0 0 0 0 0 0 + + + + + 7-color non-mixing dither, color five + + 0 0 0 1 0 0 0 0 + 0 0 0 0 2 0 0 0 + 0 0 0 0 0 3 0 0 + 0 0 0 0 0 0 4 0 + 0 0 0 0 0 0 0 1 + 2 0 0 0 0 0 0 0 + 0 3 0 0 0 0 0 0 + 0 0 4 0 0 0 0 0 + + + + + + 7-color non-mixing dither, color six + + 0 0 0 0 0 2 0 0 + 0 0 0 0 0 0 3 0 + 0 0 0 0 0 0 0 4 + 1 0 0 0 0 0 0 0 + 0 2 0 0 0 0 0 0 + 0 0 3 0 0 0 0 0 + 0 0 0 4 0 0 0 0 + 0 0 0 0 1 0 0 0 + + + + + 7-color non-mixing dither, color seven + + 0 0 0 0 0 0 0 4 + 1 0 0 0 0 0 0 0 + 0 2 0 0 0 0 0 0 + 0 0 3 0 0 0 0 0 + 0 0 0 4 0 0 0 0 + 0 0 0 0 1 0 0 0 + 0 0 0 0 0 2 0 0 + 0 0 0 0 0 0 3 0 + + + +