Răsfoiți Sursa

Fix BW pdf scanning not compressing as much as it can

Weiyi Lou 1 lună în urmă
părinte
comite
b04e2a6780
1 a modificat fișierele cu 9 adăugiri și 2 ștergeri
  1. 9 2
      scan-dialog

+ 9 - 2
scan-dialog

@@ -97,8 +97,15 @@ function run_scan {
       yad --progress --text="Converting to $format..." --width=300 --no-buttons --auto-close
       ;;
     pdf)
-      if [[ $colmode != "Lineart" ]]; then
-        tempname2="${tempname%.png}.jpg"
+      if [[ $colmode == "Lineart" ]]; then
+        # PNGs compress BW images better.
+        tempname2="${tempname%.tif}.png"
+        convert $tempname $tempname2 | \
+        yad --progress --text="Converting to png..." --width=300 --no-buttons --auto-close
+        rm $tempname
+        tempname=$tempname2
+      else
+        tempname2="${tempname%.tif}.jpg"
         convert -quality 85 $tempname $tempname2 | \
         yad --progress --text="Converting to jpg..." --width=300 --no-buttons --auto-close
         rm $tempname