diff --git a/02-convert.sh b/02-convert.sh index da225f5..9b6c4c4 100755 --- a/02-convert.sh +++ b/02-convert.sh @@ -10,16 +10,19 @@ simplify=2 morphology="Open:6" morphology_shape="Disk" -# Color simplification to apply (50x50% means black/white) -random_treshold="50x50%" +# Number of colors images are quantized to for component detection +colors=4 -# Treshold for connected components detection -area_treshold=500 +# Neighbors to evaluate when detecting connected components +connected_components=8 -# Parameters for sigmoidal contrast adjustment for trimming -sigmoidal_contrast_trim="35,30%" +# Area treshold for connected components detection +area_treshold=1000 -# Parameters for sigmoidal contrast adjustment for result images +# Sigmoidal contrast adjustment used when trimming +sigmoidal_contrast_trim="30,30%" + +# Sigmoidal contrast adjustment visible in result images sigmoidal_contrast="45,50%" # Number of colors result images are quantized to @@ -71,7 +74,7 @@ else -colorspace RGB \ -sigmoidal-contrast "$sigmoidal_contrast_trim" \ -resize "$resize_percent%" \ - -channel All -random-threshold "$random_treshold" \ + -colors "$colors" \ -morphology "$morphology" "$morphology_shape" \ "$tmp1" then @@ -81,9 +84,11 @@ else fi draw=() + v=255 while read -r primitive ; do - draw+=("-fill" "white" "-draw" "$primitive") + draw+=("-fill" "rgb($v,$v,$v)" "-draw" "$primitive") + v=$((v-2)) done < <( convert \ "$tmp1" \ @@ -92,7 +97,7 @@ else -define connected-components:sort-order=increasing \ -define connected-components:area-threshold="$area_treshold" \ -virtual-pixel None \ - -connected-components 8 \ + -connected-components "$connected_components" \ -auto-level \ "$com" | \ perl -e ' diff --git a/03-pdf.sh b/03-pdf.sh index d86c1be..057a37f 100755 --- a/03-pdf.sh +++ b/03-pdf.sh @@ -11,7 +11,7 @@ paper="a4paper" offset="1cm 3cm" # Factor to scale image by before placing in page -scale=1 +scale=0.75 # Filename of complete result PDF result="pdf/result.pdf"