Tag Archive: Linux

Find Files by Size

Find all TIFFs in a directory smaller than 90 MB:

$ find /dir/to/search -name *.tif -size -90M -exec ls -lh {} \;

Get just the size and path and write to a file:

$ find /dir/to/search -name *.tif -size -90M -exec ls -lh {} \; | awk '{print $5 , $8}' > output.txt

Useful for finding images that might have been scanned at the wrong resolution/bit depth/etc.

OCR with OCRopus and Tesseract

While OCRing a batch of images through OmniPage the other day, I was silently cursing my computer. I had about 1,500 pages, and OmniPage was crashing after every second or third image. I’ve used versions 13-16 of the software, and this problem seems to just get worse with each new release. Fed up, I decided to look for an alternative.

I remembered seeing a few years ago that HP had open-sourced their OCR engine, Tesseract, development of which has now been taken over by Google. Tesseract is supposedly very good at what it does, namely, recognizing characters in images.

Tesseract does not, however, have many essential features found in modern OCR software, including document layout analysis and output formatting. That’s where OCRopus comes in. I think of it as a wrapper around Tesseract, capable of doing the layout analysis and providing formatted output. In truth, it can do much more than that, and different OCR engines and other components can be plugged into OCRopus, but the preceding simplification works for my purposes.


Use OCRopus with a simple call from the command line:

$ ocroscript recognize /path/to/file.png > /path/to/output.html

OCRopus will work its magic on file.png and give you an hOCR file. hOCR uses class and title attributes in an otherwise simple HTML file to embed layout information into the recognized text. I hope soon to create a script to transform the hOCR into a PDF; I’ll post more when it’s ready.


The trickiest part of using OCRopus is the installation. There are quite a few dependencies and some inaccurate documentation, so I made a few wrong turns along the way. Fortunately, I remembered to document what I was doing as I went. The instructions below represent the necessary steps to have an operable installation of OCRopus on Linux Mint as of 2009-03-27. For the record, I’m starting in /var/tmp.
Continue reading

Running Linux in Windows with VirtualBox

I recently decided to halfheartedly stick my toes back into the Linux waters. It’s been about six or seven years since I last played with it. At the time, I was a music student with an interest in computers, and it ended up being a little over my head. So now, a little wiser (I hope), a little more knowledgeable, I wade back in.

Rather than wiping a hard disk, or even dual-booting, I opted to go with a less committed approach. I’ve set up a virtual computer to run within Windows Vista. I tried Microsoft Virtual PC first, but I never got past the boot stage (on several Linux distributions) before it collapsed into a whimpering heap of self-contradiction. Not dissuaded, I gave Sun’s VirtualBox a try, and it worked admirably.

So I now have Linux Mint 6 installed within VirtualBox within Vista. From what I’ve read about the distribution, it’s a lot like Ubuntu, with a few additional tools to make it easier for the uninitiated to use. I have two monitors, so I’ve pretty much just dedicated one to displaying Windows and one to displaying Linux.

So far, my experience has been pretty good. For basic basic usage (i.e., Internet browsing, word processing, etc.), it seems as easy to use as Windows. mintInstall, the software installation program that comes bundled with Linux Mint, makes installation of the thousands of common software packages very easy, and apt-get fills in where mintInstall leaves off. I had XChat running happily within moments, something I still haven’t figured out how to do on Vista. I still have a bit of learning to do inside the terminal, but I’m making progress.

As I run across obstacles, I’ll try to post them here (with their solutions, I hope) so I can remember how to do things again later.