Mondeo Posted June 5, 2007 Posted June 5, 2007 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 Quote
Leaders snarfblam Posted June 5, 2007 Leaders Posted June 5, 2007 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. Quote [sIGPIC]e[/sIGPIC]
Mondeo Posted June 5, 2007 Author Posted June 5, 2007 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? Quote
Leaders dynamic_sysop Posted June 6, 2007 Leaders Posted June 6, 2007 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 :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.