You can use ImageMagick. The '-trim' option crops an image as small as possible and will tell you if your image is completely empty:
$ convert -trim no_text_images.eps foo.jpg
convert-im6.q16: geometry does not contain image [...]
convert command does not return an error code for this warning, your shell script will need to grep the stderr.
if ! convert -trim no_text_images.eps foo.png 2>&1 |
grep 'does not contain image'; then
[ there's an image, so process it ]
[ there's no image ]
However, now that I see what you're working on I may have a simpler solution for you. Why not try using
sudo apt install ocrmypdf to install it on your Debian box.
I ran it on the PDF you gave me and, even though I have my
tesseract set to English, it got a reasonable rendering of the vector you have at the top of the form:
$ ocrmypdf --force-ocr --oversample 150 084.pdf foo.pdf
$ pdftotext foo.pdf - | less
Aalbors SV- Tlf. 98 18 50 99- E-mail: firstname.lastname@example.org- www. smv. dk
53 92 79 12- Nordjyske Bank 7450- 2038354
Import, salg as distribution if Vin cg spiritus
Eneiurhandler i Danmark af
udsIgte vine fra hale verden.