Compare commits

..

2 Commits

Author SHA1 Message Date
Tilman Kranz
60b980f4b7 some manual trial & error adjustments 2023-12-10 12:14:40 +01:00
Tilman Kranz
fbe3fbecca ignore image and temporary files 2023-12-10 12:14:05 +01:00
3 changed files with 20 additions and 11 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
in
out
pdf
tmp

View File

@ -10,16 +10,19 @@ simplify=2
morphology="Open:6" morphology="Open:6"
morphology_shape="Disk" morphology_shape="Disk"
# Color simplification to apply (50x50% means black/white) # Number of colors images are quantized to for component detection
random_treshold="50x50%" colors=4
# Treshold for connected components detection # Neighbors to evaluate when detecting connected components
area_treshold=500 connected_components=8
# Parameters for sigmoidal contrast adjustment for trimming # Area treshold for connected components detection
sigmoidal_contrast_trim="35,30%" 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%" sigmoidal_contrast="45,50%"
# Number of colors result images are quantized to # Number of colors result images are quantized to
@ -71,7 +74,7 @@ else
-colorspace RGB \ -colorspace RGB \
-sigmoidal-contrast "$sigmoidal_contrast_trim" \ -sigmoidal-contrast "$sigmoidal_contrast_trim" \
-resize "$resize_percent%" \ -resize "$resize_percent%" \
-channel All -random-threshold "$random_treshold" \ -colors "$colors" \
-morphology "$morphology" "$morphology_shape" \ -morphology "$morphology" "$morphology_shape" \
"$tmp1" "$tmp1"
then then
@ -81,9 +84,11 @@ else
fi fi
draw=() draw=()
v=255
while read -r primitive ; do while read -r primitive ; do
draw+=("-fill" "white" "-draw" "$primitive") draw+=("-fill" "rgb($v,$v,$v)" "-draw" "$primitive")
v=$((v-2))
done < <( done < <(
convert \ convert \
"$tmp1" \ "$tmp1" \
@ -92,7 +97,7 @@ else
-define connected-components:sort-order=increasing \ -define connected-components:sort-order=increasing \
-define connected-components:area-threshold="$area_treshold" \ -define connected-components:area-threshold="$area_treshold" \
-virtual-pixel None \ -virtual-pixel None \
-connected-components 8 \ -connected-components "$connected_components" \
-auto-level \ -auto-level \
"$com" | \ "$com" | \
perl -e ' perl -e '

View File

@ -11,7 +11,7 @@ paper="a4paper"
offset="1cm 3cm" offset="1cm 3cm"
# Factor to scale image by before placing in page # Factor to scale image by before placing in page
scale=1 scale=0.75
# Filename of complete result PDF # Filename of complete result PDF
result="pdf/result.pdf" result="pdf/result.pdf"