Skip to main content
Email Password   helpLost your password?

Introduction

Several image file formats enable you to store metadata along with an image. Metadata is information about an image, for example, title, width, camera model, and artist. Microsoft Windows GDI+ provides a uniform way of storing and retrieving metadata from image files in the Tagged Image File Format (TIFF), JPEG, Portable Network Graphics (PNG), and Exchangeable Image File (EXIF) formats. In GDI+, a piece of metadata is called a property item, and an individual property item is identified by a numerical constant called a property tag.

In .NET Framework, you can store and retrieve metadata by calling the SetPropertyItem and GetPropertyItem methods of the Image class, and you don't have to be concerned with the details of how a particular file format stores that metadata.

Another question is how can you use this data. You will receive just an array of bytes, and it is your problem how you interpret it. This library will simplify access to this image metadata by converting them to ordinary .NET data types and organizing them in the form of class properties and/or hashtable.

The primary source of information to write this class was MSDN.

MSDN Home > MSDN Library > Graphics and Multimedia > GDI+ > GDI+ Reference > Constants

I'd like also to thank Jeffrey S. Gangel whose article "Photo Properties" at CodeProject brought me to the idea to write this class. His program makes basically the same, the only difference is that I wanted to have image information in the form that seems to me to be more comfortable and conventional.

Not all image property tags are implemented as class properties. Those are accessible only from PropertyItems hashtable. If anyone needs this library at all and even needs the specific property, I'll be very glad to help him. But I think it is not necessary, because the whole source code is available and modifiable.

Usage

// Accessing image proprties

public void ShowEquipModel() 
{ 
    Info inf=new Info("c:\\tmp\\Example.jpeg"); 
    MessageBox.Show(inf.EquipModel);
}
// Accessing image proprties as a hastable 

public void ShowAllProperties() 
{ 
    Info inf=new Info("c:\\tmp\\Example.jpeg");
    listView.Items.Clear(); 
    foreach (string propertyname in inf.PropertyItems.Keys) {
        ListViewItem item1 = new ListViewItem(propertyname,0);
        item1.SubItems.Add((inf.PropertyItems[propertyname]).ToString());
        listView.Items.Add(item1); 
    } 
}

The properties of the Info class are listed below:

See also

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralCan I use this dll? Pin
u8521001
2:10 30 Sep '08  
AnswerRe: Can I use this dll? Pin
George Mamaladze
12:21 30 Sep '08  
GeneralProblem - Image files are left locked Pin
johnieT
4:50 23 Sep '08  
GeneralRe: Problem - Image files are left locked Pin
johnieT
2:15 24 Sep '08  
QuestionTerms of Use? Pin
Omnicoder
15:19 22 Apr '08  
AnswerRe: Terms of Use? Pin
George Mamaladze
10:22 23 Apr '08  
Questionsome EXIF data not being read on some files? Pin
todd_001
15:50 16 Jan '08  
GeneralRe: some EXIF data not being read on some files? Pin
George Mamaladze
23:56 16 Jan '08  
GeneralRe: some EXIF data not being read on some files? Pin
todd_001
9:58 17 Jan '08  
GeneralRe: some EXIF data not being read on some files? Pin
George Mamaladze
11:06 17 Jan '08  
GeneralRe: some EXIF data not being read on some files? Pin
todd_001
16:57 19 Jan '08  
GeneralRe: some EXIF data not being read on some files? Pin
todd_001
19:21 19 Jan '08  
GeneralGreat work Pin
Davorin Sajnovic
0:55 22 Apr '07  
GeneralI used it, get the source Pin
motisaadon
0:27 20 Mar '07  
GeneralResolutionUnit Pin
damoose75
3:26 21 Dec '06  
GeneralSpeed ups [modified] Pin
lummie
8:53 25 Oct '06  
GeneralExtract image (tiff and jpg) metadata Pin
mindang
21:03 15 Oct '06  
GeneralRe: Extract image (tiff and jpg) metadata Pin
George Mamaladze
22:18 15 Oct '06  
GeneralRe: Extract image (tiff and jpg) metadata Pin
mindang
17:02 16 Oct '06  
GeneralRe: Extract image (tiff and jpg) metadata Pin
mindang
17:43 16 Oct '06  
Generalowner url Pin
wijesijp
6:47 6 Sep '06  
QuestionHow would i write this in Visual Basic? Pin
mac.macananny
5:32 18 Aug '06  
AnswerRe: How would i write this in Visual Basic? Pin
George Mamaladze
6:52 23 Aug '06  
AnswerRe: How would i write this in Visual Basic? Pin
AlenCroatia
2:09 24 Nov '08  
GeneralRe: How would i write this in Visual Basic? Pin
George Mamaladze
4:48 24 Nov '08  


Last Updated 3 Aug 2004 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009