[Unix] Translating a text from screenshot

While installing a German software, I was stumbled by this:

(Sorry, software's name has been redacted due to NDA.)

Of course, I know no German (maybe except couple of words from German porn movies), and the text cannot be copypasted from a Win32 message box. (And I had no energy to dive into Win32 resources, etc...)

So I cut the text using GIMP (any image editor would suffice):

And I recalled about the free OCR software for Linux: tesseract, a command-line program that can take an image at output and print a text. Not always perfectly, but fine for my job.

And also, a Linux command line utility to query Google translate service: translate-shell.

Calling it:

 % trans de:en "Fehler beim Anwenden eines Patches auf die Datei |PT72CD.tmp. Die Date! wurde wahrscheinlich bereits anderveitig aktuaisiert und kann durch diesen Patch nicht madifizert werden. Wenden Sie sich an den Hersteller des Patches, um weitere Informationen 2u,"

Fehler beim Anwenden eines Patches auf die Datei |PT72CD.tmp. Die Date! wurde wahrscheinlich bereits anderveitig aktuaisiert und kann durch diesen Patch nicht madifizert werden. Wenden Sie sich an den Hersteller des Patches, um weitere Informationen 2u,

Error applying a patch to file | PT72CD.tmp. The date! has probably already been updated on the other side and cannot be modified by this patch. Contact the patch manufacturer for more information 2u,

Translations of Fehler beim Anwenden eines Patches auf die Datei |PT72CD.tmp. Die Date! wurde wahrscheinlich bereits anderveitig aktuaisiert und kann durch diesen Patch nicht madifizert werden. Wenden Sie sich an den Hersteller des Patches, um weitere Informationen 2u,
[ Deutsch -> English ]

Fehler beim Anwenden eines Patches auf die Datei |PT72CD.tmp.
    Error applying a patch to file | PT72CD.tmp., Error applying patch to file | PT72CD.tmp.
Die Date!
    The date!
wurde wahrscheinlich bereits anderveitig aktuaisiert und kann durch diesen Patch nicht madifizert werden.
    has probably already been updated on the other side and cannot be modified by this patch., It has probably been aktuaisiert anderveitig and can not be madifizert by this patch.
Wenden Sie sich an den Hersteller des Patches, um weitere Informationen 2u,
    Contact the patch manufacturer for more information 2u,, Refer to the manufacturer of the patch for more information 2u

Isn't it cool?

Grep-ing your desktop screenshots

I also use a script that make a screenshot of my desktop once in a minute (using ImageMagick):

#!/bin/bash

# https://wiki.debian.org/ScreenShots

while true;
do
        PATH_=`date +%Y-%m-%d`
        mkdir -p ~/tmp/$PATH_
        FNAME=`date +%s-%H-%M-%S-%Z`
        import -window root ~/tmp/$PATH_/screenshot_$FNAME.jpg
        sleep 60s
done

It was inspired by Stephen Wolfram:

I have systems that keep all sorts of data, including every keystroke I type, every step I take and what my computer screen looks like every minute (sadly, the movie of this is very dull).

Now I can pass all these images through tesseract and grep to find something I can't remember. (Including many texts I've read on web, social networks, etc.)


List of my other blog posts.

Yes, I know about these lousy Disqus ads. Please use adblocker. I would consider to subscribe to 'pro' version of Disqus if the signal/noise ratio in comments would be good enough.