Get image file properties

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Loveless

    #1

    Get image file properties

    Hi all, I would like to create a routine that retrieves specific properties
    from an image file (ex. a jpeg) without having to open
    the file. For example, in WinXP when you right-click a jpg file and select
    properties, then summary, you are presented with information about the image
    (height, width, resolution, colour depth etc.). I know how to create a
    FileInfo object and retrieve the file attributes, but the attributes
    returned are the standard hidden, system, read-only and archive attributes.
    Is there a way of retrieving this "extra" information. I don't want to open
    the file to get this information because of the time and memory required to
    do so, particularly if there are hundreds of image files to go through.

    Does anyone have any ideas?

    Regards,
    Paul.


  • Herfried K. Wagner [MVP]

    #2
    Re: Get image file properties

    Hello,

    "Paul Loveless" <paull2@rogers. com> schrieb:[color=blue]
    > Hi all, I would like to create a routine that retrieves specific
    > properties from an image file (ex. a jpeg) without having
    > to open the file. For example, in WinXP when you right-
    > click a jpg file and select properties, then summary, you
    > are presented with information about the image
    > (height, width, resolution, colour depth etc.). I know
    > how to create a FileInfo object and retrieve the file
    > attributes, but the attributes returned are the standard
    > hidden, system, read-only and archive attributes. Is
    > there a way of retrieving this "extra" information.[/color]

    There is no general way for all file formats. I would suggest to open the
    file and read only the parts required to determine the size of the image.
    You can find information on the file formats at Wotsit[1].

    [1] http://www.wotsit.org

    --
    Herfried K. Wagner
    MVP · VB Classic, VB.NET
    Die Website von H. Wagner zu .NET, Visual Basic .NET und Classic Visual Basic.



    Comment

    • Paul Loveless

      #3
      Re: Get image file properties

      Thanks for the reply. I was hoping for another way, but c'est la vie.

      Regards,
      Paul.

      "Herfried K. Wagner [MVP]" <hirf.nosp@m.ac tivevb.de> wrote in message
      news:OwUWAYheDH A.4024@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Hello,
      >
      > "Paul Loveless" <paull2@rogers. com> schrieb:[color=green]
      > > Hi all, I would like to create a routine that retrieves specific
      > > properties from an image file (ex. a jpeg) without having
      > > to open the file. For example, in WinXP when you right-
      > > click a jpg file and select properties, then summary, you
      > > are presented with information about the image
      > > (height, width, resolution, colour depth etc.). I know
      > > how to create a FileInfo object and retrieve the file
      > > attributes, but the attributes returned are the standard
      > > hidden, system, read-only and archive attributes. Is
      > > there a way of retrieving this "extra" information.[/color]
      >
      > There is no general way for all file formats. I would suggest to open the
      > file and read only the parts required to determine the size of the image.
      > You can find information on the file formats at Wotsit[1].
      >
      > [1] http://www.wotsit.org
      >
      > --
      > Herfried K. Wagner
      > MVP · VB Classic, VB.NET
      > http://www.mvps.org/dotnet
      >
      >[/color]


      Comment

      • aws910
        New Member
        • Jul 2006
        • 1

        #4
        I gotta share my recent experiences here.

        I had major problems with things like this in asp.net and actually had to purchase 3rd-party plugins to help me get file information (among other things). It seemed like every time I wanted to do something special, only a 3rd-party plugin($) could really do what I wanted to do. I recently discovered the magic of open-source, and in Apache/PHP, you can not only retrieve basic image info (width, height, color, etc) with GD2, but with EXIF, you can also easily retrieve advanced image information (Ever wonder where all that extra data like camera model, focus, etc is stored?). All this for free, and it runs 10x faster than IIS/ASP. If I wasn't just patching up someone else's app right now, I'd convert it to open source posthaste!

        ....So if you're sitting there at 3am, scratching your head, wondering "How can they NOT have something like this built-in??", maybe it's time to look on the other side of the fence. You will seldom hit dead-ends as "w-t-f"-ish as this one.

        Oh, and my client was pleased to learn that MySQL was free(as opposed to M$ SQL - like $4k?). That got me a nice little bonus.

        Comment

        Working...