Image Manipulation (1 Viewer)


Super Moderator
Staff member
Sep 12, 2006
I just added an option to a database to load images from a folder and display them.
It just displays the images - no zoom etc, or other manipulation, but one issue is that the orientation of the photo as stored in the image folder is not respected. I imagine it's displaying the way the photo was taken. I wondered if there was an easy fix for this.

It's OK-ish as it is, and better than nothing. I just wondered if there was an easy fix. I'll keep looking, but I can't find anything on the forum.

I found this, which might help.
Solved - VBA - Image control, orientation incorrect, get EXIF data | Access World Forums (
hi @gemma-the-husky

for manipulating image files with Access, I like Irfanview since it has switches you can end to the end of the command line to change things. Here's an example using VBA to use Irfanview to resize

... and in References, I see the link to switches isn't right! But maybe good enough to see how you can use it, but you'll have to find the right link (sorry about that). Irfanview is a free download from Irfan Skiljan

you can also use WIA

here's a link with an example, and lots of info in References

I contributed to the thread linked in post #1 & you can try my example app which both detects the orientation and allows users to correct it.

For JPG photos from a phone or camera, it is possible to both detect and do the correction automatically but that isn't always the desired outcome

that's great Colin, thanks. I just tried v3.4 and It's producing a file not found error trying to rotate images, but it says it can't find file temp.jpg while trying to do a rotate 270 degrees (6) - but hopefully I can sort that out. It's a great layout, I just built a form with an image viewer and left/right buttons, but then I got this rotate issue, with no easy solution.
The first version did show a list of files, but that wasn't the issue.
I have a folder of images with 4 files, two of which are rotated.

When it tries to present a rotated image I get this error.

Hi Colin

I investigated, and It seems to be failing in this sub

Sub imgRotate(inFile As String, outFile As String, degreesRotate As Long) '90, 180, 270
    Dim img As Object, IP As Object
    Set img = CreateObject("WIA.ImageFile") 'create WIA objects
    Set IP = CreateObject("WIA.ImageProcess")
    IP.Filters.Add IP.FilterInfos("RotateFlip").FilterID 'setup filter
    IP.Filters(1).Properties("RotationAngle") = degreesRotate
    img.LoadFile inFile 'load image
    Set img = IP.Apply(img) 'apply change
    Kill outFile 'delete original image so it can be overwritten
    img.SaveFile outFile 'save new image
End Sub

on the one but last line kill outfile
any file temp.jpg was already deleted before calling this sub, so this line produces a rte 53.

I added on error resume next
before 3 instances of this code in the module modWIA and that got the rotation working correctly.

I couldn't understand at first why you only rotated by 90 degrees, for a 270 degree rotation, but then I got it!
And it's really helpful, thanks.
Posts crossed
Sorry. I had uploaded a faulty version.
I've just replaced the attachment in post #5 with v3.5 which seems to work fine.
I've also included two folders of photos you can use for testing
The TestPhotos folder contains multiple images of the letter F that I used for testing the rotation functionality


I'll also update the website now

I am trying to make a database to let people manage collections, antiques, for example, and I wanted to let them display a set of images for a given item. Access was showing the original orientation of a photo, even if it been rotated in Windows. Colin's code got to the EXIF data, and rotated them again to display them correctly. That's just what I want for this.
I've just updated my website article with additional info, new screenshots & the updated version 3.5 that I completed last August but had forgotten to upload previously.

Here is a screenshot of the main form:


As the screenshot shows, JPEG images from cameras/phones are automatically rotated based on the EXIF orientation data.
You can also choose to save the rotated image if you wish.

The app should do exactly what Dave (GTH) needs.
Last edited:

Users who are viewing this thread

Top Bottom