Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm building a custom file browser for my application, I want to list certain files based on thier name so i've used io.directory.getfiles and filtered the results.

 

But In windows explorer i've noticed that certain files have extended attributes over and above thier standard read only, hidden etc etc.

 

For example jpegs have height and width. It would be great if I could read this information using something like io.fileinfo. Are these details actually embedded in the file itself and can they be read?

 

Thanks

  • Leaders
Posted
How and where these types of details are stored depends on the file type. For JPEGs, the width and height are stored within the file. MP3s contain most of this type of extra data in ID3 tags within files. Some information for certain file types is stored in "alternate file streams," a feature of NTFS. So, as far as I know, there is no simple and standard technique that can be used in a general fasion to get this type of data from files.
[sIGPIC]e[/sIGPIC]
Posted
What about jpegs? Is there an easy way to get that info, besides opening each file as an image and checking its height and width properties?
  • Leaders
Posted

you need to be looking at " System.Drawing.Imaging.PropertyItem "

if you look at the Image class you will see that there is a field called

PropertyItems, eg:

       Dim img As Image = Image.FromFile("E:\Image1.jpg")
       For Each propItem As System.Drawing.Imaging.PropertyItem In img.PropertyItems
           '/// here you can look at the value of each properyitem ( height , etc... )
           '/// you need to determine what the value is ( string, byte, byte array, etc... by it's ID )
           '/// there's a list if ID tags on msdn here ---> [url="http://msdn2.microsoft.com/en-us/library/system.drawing.imaging.propertyitem.id.aspx"]ID TAGS[/url] <---
       Next

look for 0x0100 PropertyTagImageWidth in the list on the link --> ID TAGS <-- for example, that should show your image width, you can see every detail of an image using PropertyItems.

hope it helps :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...