{"id":2199,"date":"2011-10-12T05:36:33","date_gmt":"2011-10-12T10:36:33","guid":{"rendered":"http:\/\/www.bytebot.net\/blog\/?p=2199"},"modified":"2012-09-04T23:25:53","modified_gmt":"2012-09-05T04:25:53","slug":"how-i-prepare-expense-reports","status":"publish","type":"post","link":"https:\/\/www.bytebot.net\/blog\/archives\/2011\/10\/12\/how-i-prepare-expense-reports","title":{"rendered":"How I prepare expense reports"},"content":{"rendered":"<p>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 &#8211; 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.<\/p>\n<p>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&#215;2480 pixels), which average anywhere between 3-12MB per page for one JPG image. The scans to PDFs don&#8217;t make sense because I can&#8217;t concatenate PDFs the way I can JPG images (and the sheet feeder only handles about 15 or so sheets at once, reliably &#8212; its very easy to get paper jams when you have staples and loose paper).<\/p>\n<p>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 &#8212; <tt>brew install imagemagick<\/tt>). ImageMagick wouldn&#8217;t install due to a conflict with pkg-config from Mono, and since I don&#8217;t use Mono any longer I trashed that.<\/p>\n<p>Then it was as simple as:<\/p>\n<blockquote>\n<p><tt>ls -1 *.jpg | sed \"s\/\\(.*\\)\\.jpg\/\\1.jpg \\1_thumb.jpg\/\" | xargs -n 2 convert -resize 1024 -quality 70<\/tt><\/p>\n<\/blockquote>\n<p>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!<\/p>\n<p>How do I generate PDFs? Simply open all the thumbnails (open -a Preview *_thumb.jpg) and then do a Print to PDF from Preview.<\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8211; there we just stuffed it all into an envelope without any order and someone presumably went through all of them [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1,1406],"tags":[1297,154,1296],"class_list":["post-2199","post","type-post","status-publish","format-standard","hentry","category-general","category-oss","tag-expense-reports","tag-imagemagick","tag-shell-scripting"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p4vJD-zt","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts\/2199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/comments?post=2199"}],"version-history":[{"count":2,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts\/2199\/revisions"}],"predecessor-version":[{"id":2473,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/posts\/2199\/revisions\/2473"}],"wp:attachment":[{"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/media?parent=2199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/categories?post=2199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bytebot.net\/blog\/wp-json\/wp\/v2\/tags?post=2199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}