Click here to Skip to main content
15,538,270 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to get the 'Date Taken' information from JPEG files using VB.NET.

[Email removed]
Posted
Updated 29-Mar-16 20:16pm
v2

Here is what you need:
http://msdn.microsoft.com/en-us/library/xddt0dz7.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.imaging.propertyitem.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.image.propertyitems.aspx[^].

In a nutshell: you can access image metadata via the class Image. The meta-data is organized into PropertyItems of the type PropertyItems recognized by the values of Id. I suggest you wrap the set of Ids in enumeration types listing known Ids shown in the first link. See for a code sample on the same page.

—SA
 
Share this answer
 
You can use code like this to get the date:
You need at Form with a Button and a Label to run this code.


Imports System.Drawing.Imaging
Imports System.IO
Imports System.Text
Public Class Form1
Private DateTime = &H132 '306


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

'Create an Image object.
Dim image As Bitmap = New Bitmap("C:\billede\FakePhoto.jpg")
Dim pic_time As PropertyItem
Dim Str_pic_time As String


'Get the PropertyItems property from image.
Dim propItems As PropertyItem() = image.PropertyItems
pic_time = image.GetPropertyItem(DateTime)
Str_pic_time = Encoding.ASCII.GetString(pic_time.Value, 0, pic_time.Len - 1)
Label1.Text = Str_pic_time
End Sub
End Class




Regards
Erik Arndal
Aarhus, Denmark
 
Share this answer
 
Comments
alcitect 29-Sep-14 13:02pm    
thanks that good information
mdk_john5 4-Aug-17 19:31pm    
Note.. Solution above is very slow so if you're planning on parsing lots of images it will run at around 1-2 seconds an image if each image is around 15Mb.
Bayu Tri Ismoyo 20-Nov-17 23:31pm    
i try it, but lose. please help.
There are number of articles on the subject:
Search - CodeProject - exif[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900