Check image details like resolution, dimensions, color mode, file format, file size and file name RRS feed

  • Question

  • I have 1000 images in a folder, i want to check their details like resolution, dimensions, color mode, file format, file size and file name into excel with nice user interface.

    Pls help me, m just learning ABCD in VB.

    Tuesday, January 6, 2015 2:57 PM

All replies

  • Hi

    Hope the below code helps you extract the dimension format and file size.

    Public Sub ExtractFilePropeties()
        Dim arrHeaders(35)
        Dim strPath
        strPath = "C:\ImageFolder\" ''Specify the Image folder name
        Set objShell = CreateObject("Shell.Application")
        Set objFolder = objShell.Namespace(strPath)
        For i = 0 To 34
         Cells(1, i + 1) = objFolder.GetDetailsOf(objFolder.Items, i)

        Dim fileIncrementer As Integer
        For Each strFileName In objFolder.Items
         For i = 0 To 34
          Cells(fileIncrementer + 2, i + 1) = objFolder.GetDetailsOf(strFileName, i)
         fileIncrementer = fileIncrementer + 1
    End Sub

    Extended Prop link:


    Wednesday, January 7, 2015 5:38 AM
  • Hi,

    Thanks for posting in MSDN forum.

    This forum is for developers discussing issues involve Excel appliction. For example, use Excel object model to automate Excel application or customize UI in Excel.

    >>Pls help me, m just learning ABCD in VB.<<

    Did you mean that you want develop with VBA? If yes, I would like to move it to VBA forum to get more effective response.

    If it means VB.Net, Visual Basic is the correct forum.

    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, January 7, 2015 6:07 AM
  • Hi,

    I have checked this method in other forum, other than these we can extract 283 attributes from a folder.  But main thing for me is color mode and compression. Can u pls suggest me any other option...


    Thursday, January 8, 2015 10:31 AM
  • Hi,

    No, thats the typo error (Pls help me, m just learning ABCD in VB)

    Excel Macros instead of VB


    Thursday, January 8, 2015 10:34 AM
  • You are asking about reading the file's EXIF tags, potentially over 100 though typically about 30. EXIF data is stored in a separate part of the file, similar to say Office Document properties or MP3 tags.

    It is certainly possible to read and translate any EXIF tags with VBA, and say loop a folder and dump each file's complete EXIF data into a spreadsheet. However to write the code from scratch would be a lot of work, even for an expert.

    Thursday, January 8, 2015 4:52 PM
  • Hi,

    Can u pls explain this with codes, pls…

    It helps a lot for me


    Friday, January 9, 2015 3:36 AM
  • I use a tool called ImageMagick.  You have an option to install a com interface so you can call it from VBA directly or you can use win32 commands.  ImageMagick does anything you want with images (at least I haven't found anything I can't do).  It is a little overwhelming to sort through all its capabilities.  It has good documentation and a very helpful forum.

    Friday, January 9, 2015 2:26 PM
  • Hi mogulma52,

    Thanks for your reply.

    Iam now learning basic of excel macros/VBA, can u pls explain this with codes..


    Saturday, January 10, 2015 3:41 AM
  • It would be difficult and take a long time to go through the code here and explain how it all works, I don't fully understand it all myself! If your objective is to learn abut VBA macros, how to read EXIF tags from file using only VBA is not a good introduction, even though it is possible.  

    The tool suggested by mogulman52 looks very comprehensive though with a quick look I'm not sure if it has methods to access EXIF tags, it seems to be mainly about image processing. It is a DLL with methods and functions you can call from VBA, you would need to read the documentation.

    Sunday, January 11, 2015 5:03 PM
  • The code in the file at the link below might give you a starting point. Firstly it gives you the opportunity to list all of the properties of a file type and then you can select the properties that you want and the second utility gives you the opportunity to list the selected properties for all files in a selected folder.

    Download and extract the file and open the file in Excel.

    Click the first button List Meta Data for One File (Run first)

    Navigate to and Select any ONE individual photo file. (Photo files because that is what you indicated you are working with.)

    You will be presented with a list of the available properties for the file. Where the Item value is blank, that property is not recorded for the particular file. Different file types have different properties and it is also dependent on how the file was created but generally if all of the files come from the same source then the same properties are recorded for all files from that source.

    Now insert a Y in column D for all of the required properties. (Don't select any with the Item value blank)

    Click the second button List Selected Meta Data for all Files in a Folder (Run after selecting the required properties).

    Next select a folder where the files reside. (You might need to back up to the folder if dialog is blank because it will not show individual files because the code only allows Folders.)

    You will be presented with a report listing all of the selected properties for all of the files in the selected folder.

    The user interface is not that great but you can improve on that if you want to with a Userform as you get to know VBA a little better.

    Download the file from here.!273&authkey=!ANf8R0Xf0-h3wJ8&ithint=file%2czip

    Regards, OssieMac

    Monday, January 12, 2015 4:01 AM
  • Hi OssieMac,

    Thank you very much for your valuable suggestion.

    I have worked with this method earlier, but in this method we can't check image compression type and color mode.

    Can we have other method for these attributes...?

    Required Attributes:

    • File Name
    • File Size
    • File Format
    • Width
    • Height
    • Resolution
    • Compression (unable to get)
    • Color Mode (unable to get)


    Monday, January 12, 2015 6:56 AM
  • If not what you are after then sorry I can't help.

    I thought that it covered all of the metadata available so if not then I doubt that you can do what you want with VB because I am not aware that VB can extract anything else.

    Regards, OssieMac

    Monday, January 12, 2015 7:22 AM
  • I had the same question and checked this code and it works perfectly!

    Today is 10/5 2018.

    Many thanks to the Author

    Vaya con Dios,

    Chuck, CABGx3

    Chuck, CABGx3

    Friday, October 5, 2018 3:42 PM