Enabling Image Search by OCR Results in Eagle
Table of Contents
Background
Eagle is a user-friendly image management software.
It offers comfortable operability and allows for classification and search using folders and tags, making it ideal for managing large quantities of images.
However, Eagle lacks OCR functionality, making it impossible to search for text within images.
Although you can make the text searchable by writing it in the Notes...
section, it's cumbersome to input the text manually.
To address this, I utilized the Cloud Vision API, which supports Japanese and has high accuracy, to enable searching by OCR results.
What I Did
The script is publicly available here:
Each image in Eagle is stored in a folder with a corresponding metadata.json
file.
The metadata contains an annotations
item, which can be rewritten to reflect the text string, making it searchable in the Notes...
section.
Note that when rewriting the metadata, you need to perform a Force Reload Library
to make it usable in Eagle.
After traversing the directory containing the images, I used the Cloud Vision API to obtain OCR results.
Using the GCP library (@google-cloud/vision
) makes it easy to execute.
Although this process may be concerning for large quantities of images, the cost is $1.5 per 1,000 images, so I didn't worry about it.
Here's an example of running the script on a Wikipedia image:
The script recognizes text on the globe and accurately detects the desired text, including Japanese characters.
With this, searching for "Wiki" will yield a hit.
Conclusion
This enables searching for images containing text, making Eagle more convenient to use.
It's convenient that metadata can be easily modified.