List image file names and dimensions (width & height) contained in a folder

List image file names and dimensions (width & height) contained in a folder

7
NewbieNewbie
7

    Feb 27, 2012#1

    Hello there,

    I have a quick question regarding how to list all images and their dimensions (width and height) in a directory.
    I need to read and ideally write to a text file all image file names with the dimensions to be used in a XML document.
    I only need to read .png, .jpg and .gif files from the folder.

    I have tried using the DOS dir command without success as it can only list file names but not image resolution information, which I happen to need for my current project.

    Thank you in advance for your help.

    2362
    MasterMaster
    2362

      Feb 27, 2012#2

      There is a little command line tool that you can use, and set up as a tool within UE. (Capturing the output to the editor, you should be able to configure it to do what you want.) It's "Image Dimensions" (ImDim.exe), and is available at http://www.gdargaud.net/Hack/Utils.html

      It can only handle JPG and PNG files, however, not GIF. You'll need to locate a different utility or have one written if you need to do that as well.

      Another solution might be to use IrfanView from the command line. There is a discussion about using IrfanView to get image dimensions and put them in a text file at http://irfanview-forum.de/showthread.ph ... mmand-line

      Not a complete answer, but a point in the right direction to start your search.

      6,680583
      Grand MasterGrand Master
      6,680583

        Feb 28, 2012#3

        Foxy in IrfanView forum made a very good job. His batch script is working fine. I changed the line with the file extensions definition to

        Code: Select all

        set filext=*.gif *.jpg *.png
        and inserted an extra space on line

        Code: Select all

        echo Width:  %width% Pixel >> "%dims%"
        to get a perfect alignment with the Height: line below in the output file. Of course the values for the environment variables dims and iview needed to be adpated to my local directory structure too. But then the batch script was ready and produces a text file which can be processed further by UltraEdit macros or scripts.

        7
        NewbieNewbie
        7

          Feb 28, 2012#4

          Thanks to both of you for point me to the right tool.

          And thanks also to foxy for his script.

          It is now working and getting the dimensions for the files I need.