I was recently attempting to run a full system upgrade, and my OS asked me which version of something called “tesseract” I wanted to install.
Upon looking it up, it seems it’s some sort of image processing to detect text in an image. This is doubtless a helpful feature for many, but it also seems it’s based on some sort of machine learning system, which tend to be rather bloated software-size-wise and very RAM intensive to use.
I try to keep my desktop’s perfomance overhead low since my laptop is… bad, but I’d prefer not to have to uninstall spectacle, as it is one of my favorite screenshot applications. Will it still function without the library and, if so, could it be listed as an optional dependency?
Tesseract has been around since the 80s and was open sourced in 2005. This is not you regular AI/LLM bloat. Indeed, it is not bloat at all. It is lean and fast and works well on under-powered and old machines. Did I mention it was originally written in the 80s? It is also a fundamental block in things like Spectacle’s “text-reading” capabilities, and is very modular, as you can install only the languages you need. It will also not consume any memory or processing power until it is needed.
TL;DR: If your laptop is running slow, Tesseract isn’t the culprit.
Will it still function without the library and, if so, could it be listed as an optional dependency?
It won’t function without the library and it won’t be made optional, but it will function without the trained data. Not having trained data effectively disables OCR.
The data is the heavy part, but only heavy in terms of file size. Debian/Fedora/openSUSE/Ubuntu (others too) can block packages you don’t want. Arch can’t block packages, but it can block files. On Arch, you can try adding either of these to /etc/pacman.conf:
No trained data: NoExtract = usr/share/tessdata/*.traineddata
Just English and extra features like script detection and rotation support: NoExtract = usr/share/tessdata/*.traineddata !usr/share/tessdata/eng.traineddata !usr/share/tessdata/osd.traineddata
Even with all the trained data installed, it should have no impact on the general performance of Spectacle and very little impact on RAM usage. It’s far more efficient than you think.
Accessibility is important and I’m glad the feature exists, but I don’t understand why it’s a required dependency. I understand OCR functionality won’t work without Tesseract, but I personally don’t want any OCR or text parsing functionality on my computer.
It’s not integral to the functionality of Spectacle as a whole per https ://discuss.kde.org/t/spectacle-ocr-function-gone/45776 since Spectacle continued to work just fine when Tesseract failed to load.
All I’m asking for is to non-critical dependencies be marked optional instead of required.
Because it’s inconvenient for me to make it optional for the minority of users that will build Spectacle without Tesseract. I have to separate more code paths to maintain it as an optional dependency. While it’s possible to do, it’s especially annoying when you mix in QML UIs since QML doesn’t have anything like C preprocessor directives. You can do CMake text replacement instead, but that has all of the problems that editing code with regex would. Doable, but easy to end up with bugs that you don’t notice until someone reports it.
Like I’ve said, there are already ways to effectively disable the functionality and avoid most of the download/install size issue, which is the main issue with depending on Tesseract. The Tesseract API library is not that big and doesn’t really eat up system resources if you’re not doing OCR. It’s not like you’re running some kind of AI/Large Language Model/cloud service in the background, or really anything at all. OCR is only done on demand and only done locally without using some kind of internet service. I think that people who ask for an option to build without it are overestimating the impact of building without it.