Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    DittoBird's Avatar
    DittoBird is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Location
    Newfoundland & Labrador, Canada
    Posts
    59

    Getting Image EXIF Information Through Access VBA

    Sorry, having an awful time with the images here. Why won't this site let me delete images and replace them? Hopefully you can figure out what images are what.

    Hi folks, I've been searching for a few days on this and the most promising approach, using WIA (Windows Image Acquisition) seems to be no longer supported my MS (see top of https://docs.microsoft.com/en-us/pre...aaut-startpage). The information that I can find is above my level of experience.

    For example, the code here (https://myengineeringworld.net/2018/...ixels-vba.html) works nicely - but still uses WIA. Further, I don't know how to find the various properties that will give me all the information in this screen shot, particularly Date Taken, program used to process it (GIMP in this case), and camera used.

    Click image for larger version. 

Name:	ImageDatas.JPG 
Views:	31 
Size:	105.2 KB 
ID:	45833

    Other methods that don't use WIA are confusing to me.

    With or without WIA, can anyone help?

    Background is I am making an inventory of equipment and space of numerous marine related sites and on some visits, I take 500+ images. It is a very onerous time drain to data enter "2 June 2021", "iPhone 7", "GIMP Resize + 1.4 gamma correction" for each image I identify on a form/table and the ability to just draw similar information from each photo would be a tremendous time saver in the field.

    Click image for larger version. 

Name:	ImageData2s.JPG 
Views:	30 
Size:	85.0 KB 
ID:	45834

    Thanks in advance for any suggestions.
    --


    Tim
    Last edited by DittoBird; 07-24-2021 at 03:15 PM. Reason: Smaller images

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You haven't stated what data you want from each photo

    I have an example app which extracts the geolocation info from the EXIF data in photos. See Get Geolocation From Photos - Mendip Data Systems

    This uses a modified version of code originally by Wayne Phillips of EverythingAccess.com: Access/VBA Tutorials - Extracting GPS data from JPEG files (everythingaccess.com)

    If that's not what you want, then another possibility is to look at the extended file properties for your photos (as can be seen by right clicking in Explorer)
    I also have an example app for that: Extended File Properties - Mendip Data Systems.
    This is an example of the extended file properties data from a photo taken on my phone:

    Click image for larger version. 

Name:	Capture.PNG 
Views:	31 
Size:	38.0 KB 
ID:	45830

    Hope that helps
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Can use Shell manipulation to get a lot of file properties https://www.devhut.net/2018/10/23/vb...imensions-etc/
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    The site will allow you to delete images after posting. In fact I often do so where the image is very large
    However, the whole process of adding or removing images is clunky...Advanced...Manage Attachments...Tick the image to include...untick to remove.

    I've also tried dragging images to insert them. This works on many forums.
    At first it appears to work here as well, but when you try to send the post you get an error message about exceeding 50,000 characters or similar
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    DittoBird's Avatar
    DittoBird is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Location
    Newfoundland & Labrador, Canada
    Posts
    59
    Quote Originally Posted by June7 View Post
    Can use Shell manipulation to get a lot of file properties https://www.devhut.net/2018/10/23/vb...imensions-etc/
    Thank you very much, but that was one of the sites I didn't quite understand. LOL on me.

    All the best.

  6. #6
    DittoBird's Avatar
    DittoBird is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Location
    Newfoundland & Labrador, Canada
    Posts
    59
    Quote Originally Posted by isladogs View Post
    The site will allow you to delete images after posting. In fact I often do so where the image is very large
    However, the whole process of adding or removing images is clunky...Advanced...Manage Attachments...Tick the image to include...untick to remove.

    I've also tried dragging images to insert them. This works on many forums.
    At first it appears to work here as well, but when you try to send the post you get an error message about exceeding 50,000 characters or similar
    Thank you Colin. I'll look at that in a moment - am I right in assuming no images appeared? One of them was:

    Click image for larger version. 

Name:	ImageDatas.JPG 
Views:	30 
Size:	105.2 KB 
ID:	45831

    When I look at the screen and my question, I see two images of the above and two other images of the following as "attachments".

    Click image for larger version. 

Name:	ImageData2s.JPG 
Views:	33 
Size:	85.0 KB 
ID:	45832

    As for your answer to myt question, thank you again, I will look at your third attachment, I think.

    All the best.

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    I can see both of those images in post #1. What you see and I see should be identical.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    DittoBird's Avatar
    DittoBird is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Location
    Newfoundland & Labrador, Canada
    Posts
    59
    Quote Originally Posted by isladogs View Post
    I can see both of those images in post #1. What you see and I see should be identical.
    Well, I just managed to delete them as far as I can tell. What I was seeing was "Attachments" at the bottom of my message. The first screen shots I used were huge and I resized them and uploaded again, so under attachments I saw 4 instead of 2. I'll go back and add the pics again, they are 105 and 85 kb in size. I don't think that'd too huge?

  9. #9
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Click image for larger version. 

Name:	ForumDelete.jpg 
Views:	31 
Size:	20.9 KB 
ID:	45836

    Note the delete x at the top right of the image icon. Have to mouse over it to see that IIRC.
    Start with Advanced toolbar, image icon. Look for Additional Options form below your post. Click "manage attachments"
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    DittoBird's Avatar
    DittoBird is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Location
    Newfoundland & Labrador, Canada
    Posts
    59
    Hi Colin,

    It's working great. Thank you so much. As I only need a few bits of data, I've added the Shell Controls and automation reference and here's an example. I know there's LOTS more you have available, of course.

    Thanks again.

    Code:
    Function fImageData(strFilePath As String, lngType As Long) As String
    
        On Error GoTo Err_Proc
        
        Dim strFileName As String
        Dim strPath As String
        
        Dim objShell As shell32.Shell
        Dim objFolder As shell32.Folder
        Dim objFolderItem As shell32.FolderItem
        
        Dim strPropName As String
        Dim strPropValue As String
        
        strFileName = Mid(strFilePath, InStrRev(strFilePath, "\") + 1)
        strPath = Left(strFilePath, Len(strFilePath) - Len(strFileName) - 1)
        
        Set objShell = New Shell
        Set objFolder = objShell.NameSpace(strPath)
        Set objFolderItem = objFolder.ParseName(strFileName)
    
    
        strPropName = objFolder.GetDetailsOf(objFolder.Items, lngType)
        strPropValue = objFolder.GetDetailsOf(objFolderItem, lngType)
        
        fImageData = strPropName & ": " & strPropValue
        
    Exit_Proc:
        Set objShell = Nothing
        Set objFolder = Nothing
        Set objFolderItem = Nothing
        Exit Function
    Err_Proc:
        Select Case Err.Number
            Case Else
                MsgBox "Error in ModImageData, fImageData " & Err.Number & " " & Err.Description, vbCritical, "Error", Err.HelpFile, Err.HelpContext
                Resume Exit_Proc
        End Select
    
    
    End Function
    Last edited by DittoBird; 07-25-2021 at 01:30 AM.

  11. #11
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Excellent. Glad I could help.
    I see you've recently updated the last post as you were originally having problems with the ParseName line. How did you fix that issue?

    As you say, you can get a lot of info from the extended file properties including:
    - height, width, bit depth, horiz/vert resolution, camera model & make, date taken, exposure time, f-stop, flash mode, orientation ....etc

    I found that editing an image in e.g. Paint also has the side effect of stripping out the many of the camera-specific properties including camera model / maker etc

    Its a great pity that the geolocation info isn't available under extended file properties but, as previously stated, I can get details such as latitude, longitude, altitude, camera orientation from the EXIF data of JPG photos by another method
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  12. #12
    DittoBird's Avatar
    DittoBird is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Location
    Newfoundland & Labrador, Canada
    Posts
    59
    Quote Originally Posted by isladogs View Post
    Excellent. Glad I could help.
    I see you've recently updated the last post as you were originally having problems with the ParseName line. How did you fix that issue?
    I'm embarrassed to say that I had Dimmed the three obj variables as just "object" . Derp.

    Quote Originally Posted by isladogs View Post
    I found that editing an image in e.g. Paint also has the side effect of stripping out the many of the camera-specific properties including camera model / maker etc
    Ow, will have to keep that in mind. I normally use Corel at home, but at work I'm using GIMP which I had heard of for many years and I am surprised at how good it is.

    Quote Originally Posted by isladogs View Post
    Its a great pity that the geolocation info isn't available under extended file properties but, as previously stated, I can get details such as latitude, longitude, altitude, camera orientation from the EXIF data of JPG photos by another method
    I believe it can be done using the WIA library, but as I mentioned to June7 I am a bit worried about using that given the MS message about not keeping the documentation up-to-date. All of our sites already have pretty precise coordinates for buildings, transformers, even flag poles, LOL.

    Thanks again.

  13. #13
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    No. Geolocation data isn't available from the WIA library. That's why I use a different approach with native code written by Wayne Phillips.
    You might be interested in this thread showing how/why I created my photo geolocation app (1) Obtain geolocation data from Image | Access World Forums (access-programmers.co.uk)
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  14. #14
    daolix is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2019
    Posts
    5
    WIA is GDIP, and that can do all the EXIF/GPS stuff.

  15. #15
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Hi @daolix
    Long time no see.....hope you are doing well.

    I've learnt a lot from your posts and never known you to be wrong.
    However, I've been unable to find any reference to GPS data in WIA. I've also no idea what GDIP is....

    In other words, that's all totally over my head. Please can you elucidate!

    Have you seen how I used Wayne Phillips' code to get geolocation info from EXIF data. See links in post #2. For example:

    Click image for larger version. 

Name:	Screenshot 2021-07-26 191433.jpg 
Views:	23 
Size:	186.7 KB 
ID:	45845
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 09-18-2020, 09:06 PM
  2. Replies: 5
    Last Post: 07-10-2020, 12:41 PM
  3. Replies: 6
    Last Post: 03-22-2018, 12:02 PM
  4. Replies: 1
    Last Post: 12-26-2016, 08:57 AM
  5. Replies: 3
    Last Post: 07-13-2015, 12:07 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums