Skip to content

Commit 5a23cae

Browse files
committed
ocr: back to imagemagick
1 parent d1fce4f commit 5a23cae

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Configs/.local/lib/hyde/screenshot.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,19 @@ ocr_screenshot() {
100100

101101
# execute grimblast with given args
102102
if "$LIB_DIR/hyde/grimblast" "${extra_args[@]}" copysave "$mode" "$temp_screenshot"; then
103-
if pkg_installed graphicsmagick; then
104-
gm convert "${temp_screenshot}" \
103+
if pkg_installed imagemagick; then
104+
magick "${temp_screenshot}" \
105105
-colorspace gray \
106+
-contrast-stretch 0 \
107+
-level 15%,85% \
106108
-resize 400% \
107-
-median 2 \
108-
-sharpen 1 \
109-
-convolve "0,0,1,0,0;0,1,1,1,0;1,1,1,1,1;0,1,1,1,0;0,0,1,0,0" \
110-
-normalize \
111-
-lat 15x15+5% \
112-
-monochrome \
113-
-despeckle \
114-
"${temp_screenshot}"
109+
-sharpen 0x1 \
110+
-auto-threshold triangle \
111+
-morphology close diamond:1 \
112+
-deskew 40% \
113+
"${temp_screenshot}"
115114
else
116-
notify-send -a "HyDE Alert" "OCR: graphicsmagick is not installed, recognition accuracy is reduced" -e -i "dialog-warning"
115+
notify-send -a "HyDE Alert" "OCR: imagemagick is not installed, recognition accuracy is reduced" -e -i "dialog-warning"
117116
fi
118117
tesseract_package_prefix="tesseract-data-"
119118
tesseract_packages=("${tesseract_languages[@]/#/$tesseract_package_prefix}")

0 commit comments

Comments
 (0)