Posts Tagged ‘expense reports’

How I prepare expense reports

Its been traditional since the old days to stick receipts on a sheet of paper and have them represent entries into an expense report. I think the only time this differed was at Sun – there we just stuffed it all into an envelope without any order and someone presumably went through all of them and figured out their own sane order.

Recently I had to scan about 70 pages worth of receipts (yes, imagine the expense value). My scanner creates some rather huge images (at 300dpi, with some 4128×2480 pixels), which average anywhere between 3-12MB per page for one JPG image. The scans to PDFs don’t make sense because I can’t concatenate PDFs the way I can JPG images (and the sheet feeder only handles about 15 or so sheets at once, reliably — its very easy to get paper jams when you have staples and loose paper).

Total size for everything? 300MB. A little hard to attach to an email. So I whipped out trusty ImageMagick (easily installable on MacOSX via homebrew — brew install imagemagick). ImageMagick wouldn’t install due to a conflict with pkg-config from Mono, and since I don’t use Mono any longer I trashed that.

Then it was as simple as:

ls -1 *.jpg | sed "s/\(.*\)\.jpg/\1.jpg \1_thumb.jpg/" | xargs -n 2 convert -resize 1024 -quality 70

What does that do? It simply finds all JPG files, then it saves thumbnails with a _thumb, and it uses convert (from ImageMagick) to resize it to 1024 pixels with only about 70% quality. This reduced the 300MB tome to something like 10MB!

How do I generate PDFs? Simply open all the thumbnails (open -a Preview *_thumb.jpg) and then do a Print to PDF from Preview.

Voila, all expense receipts are generated and ready for emailing. I typically like to keep attachments below 20MB in size because most mail systems reject it after that.