I received the following email last week from one of our users. The program in question generates pre-sentence investigation (PSI) reports for Pennsylvania County Probation Departments. Here's the email (lightly edited for privacy):
Good morning, quick question. We have been doing a number of PSI interviews via telephone and having the offender email us a photo for the face sheet. I attached one for an example for the Smith PSI. The majority of the time, when we save it and upload it in the PSI it uploads sideways. Is that an issue with the PSI software or the format of the photo? Thank you.
I had the user send me a sample photo. Here's how the photo looked in IrfanView:
Here's how that same photo looked when previewed in our report:
The biggest clue for me was that the problem began when offenders sent in images of themselves. When the Probation Department was taking photos during in-person visits, there was no issue.
I thought it could be a meta-data issue, so I went back to IrfanView. I clicked Image -> Information... -> [EXIF info]. Sure enough, I had my culprit. The "Orientation" EXIF tag had a value of Left bottom. IrfanView, Windows Photo Viewer, and many other image viewers automatically rotate images based on the value of this EXIF tag. Microsoft Access apparently ignores this tag.*
* I should note that it's entirely possible that Access handles this correctly by default and something I was doing in my importing and uploading of the photo was stripping out this EXIF data.
My solution was to force-rotate the image itself as part of my import process. For this, I used ImageMagick's
adjusts an image so that its orientation is suitable for viewing (i.e. top-left orientation).
NOTE: I plan to discuss how I use ImageMagick for image manipulation in an upcoming article. (If that's something you are interested in seeing, let me know at mike @ nolongerset.com and I'll prioritize it.)