473,804 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Speed up Camera Photo Time Stamp

I'm writing a program for renaming my picture files, and I want to use
the picture time stamp as a prefix to the file names. I can get the
time stamp, but it is extraordinarily slow! I have about 250 pictures
in the directory. In debug mode, I can populate the names in a
listview in less than two seconds. If I add a column with the time
stamp as a string, the listview takes about 70 seconds to populate in
debug mode. I haven't made and test a release mode yet.

Does anybody know a faster way to get the time stamp information?

'---------- Extract the picture date from the picture ----------
' Return an empty string if the file does not exist or no date tag
' Returns date string in YYYY:MM:DD HH:MM:SS
Private Function GetRawDate(ByVa l FileName As String) As String
Dim l_RawDate As String = ""
If File.Exists(Fil eName) Then
Try
Dim img As Image = Image.FromFile( FileName)
Dim i As PropertyItem
For Each i In img.PropertyIte ms
If (i.Id = &H9003 Or i.Id = &H9004) And i.Type = 2
Then
l_RawDate =
System.Text.Enc oding.Default.G etString(i.Valu e, 0, i.Value.Length - 1)
Exit For
End If
Next
Catch ex As Exception
End Try
End If
Return l_RawDate
End Function

'---------- Get the date only in YY-MM-DD format ----------
' FullDate is in YYYY:MM:DD HH:MM:SS format
' Returns date string in YY-MM-DD format
Private Function GetPictureYYMMD D(ByVal FullDate As String) As
String
Dim l_YYMMDD As String = ""
If FullDate.Length >= 10 Then
l_YYMMDD = FullDate.Substr ing(2, 2) + "-" + _
FullDate.Substr ing(5, 2) + "-" + _
FullDate.Substr ing(8, 2)
End If
Return l_YYMMDD
End Function

'---------- Populate the listview ----------
Private Sub Populate()
Dim l_Directory As String = txtDirectory.Te xt

lvw.BeginUpdate ()
lvw.Clear()
lblSelected.Tex t = "0 Selected"
If My.Computer.Fil eSystem.Directo ryExists(l_Dire ctory) = False
Then
MsgBox("Directo ry name is invalid.",
MsgBoxStyle.Exc lamation)
Else
Dim l_File As String
Dim l_Item As ListViewItem
Dim l_FileInfo As System.IO.FileI nfo
Dim s As String = ""

lvw.Columns.Add ("File Name")
lvw.Columns.Add ("Picture Taken")
lvw.Columns.Add ("Last Edited Date")
lvw.Columns.Add ("Preview")
Try
For Each l_File In
My.Computer.Fil eSystem.GetFile s(l_Directory)
l_Item = New ListViewItem(l_ File)
l_FileInfo = New System.IO.FileI nfo(l_File)
s = GetRawDate(l_Fi le)
s = GetPictureYYMMD D(s)
l_Item.SubItems .Add(s)
lvw.Items.Add(l _Item)
Next
Catch ex As Exception
End Try
End If
lvw.EndUpdate()
End Sub

Aug 1 '07 #1
2 1864
Shane wrote:
I'm writing a program for renaming my picture files, and I want to use
the picture time stamp as a prefix to the file names. I can get the
time stamp, but it is extraordinarily slow! I have about 250 pictures
in the directory. In debug mode, I can populate the names in a
listview in less than two seconds. If I add a column with the time
stamp as a string, the listview takes about 70 seconds to populate in
debug mode. I haven't made and test a release mode yet.

Does anybody know a faster way to get the time stamp information?
You are reading the entire image, which includes reading the entire file
and decompressing the image into a bitmap.

You can read the metadata directly from the file instead. That of course
means that you have to read up on the format of the file to find out how
to get to the interresting parts.

Alternatively you might find someone else who has already written code
for that.

--
Göran Andersson
_____
http://www.guffa.com
Aug 1 '07 #2
Ok, yeah, that's pretty obvious that the image variable was the
slowing down area.

I could use a background task to update the dates in my list, but I'd
rather not.

Does anybody have faster code?

Shane

Aug 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4760
by: Yang Li Ke | last post by:
Hi guys, Im about to build a script which will log visitor time spent on my website. I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then using session vars to check time out ... Anyone has any ideas about doing that kind of script? Thank you! -- Yang
6
3413
by: Newbie | last post by:
I am doing some robotics projects but my main area of interest is trying out several algorithms for the processing of the stream of data coming from the video. I am wondering what type of camera I should invest in. Either I could buy a web cam and hope I can find a driver I could either modify or use. i.e. every frame is somehow stored on the computer automagically or I could buy a camera not unlike the AVRcam...
1
2061
by: Pola | last post by:
I am working with IIS. I am using ISAPI Extension dll, that runs on the web server. I am working on the appl that have to receive images(jpeg from video camera) in the real time. the client accept images using Internet Ex. (no apps run on client side). Using technology of the ISAPI Extension dll client accept images with big interval (1 image(the size of the img 5000KB) per sec). The technology of the ip camera (web camera) enable to...
7
19635
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance, Don Following running on client-side:
1
1456
by: Bill | last post by:
Does anyone know of a Python program that will re-name digital photo files in a date-time format based on the date stamp of the file?
8
3043
by: Alexander Fischer | last post by:
Hello, I am writing a gallery script and use imagecreatefromjpeg and fpassthru to output images without any change to them (i.e., no thumbnail creation etc. - just deliver the image via the php script). However I note that the image creation is quite slow - the user can see that the image is created line-by-line, from top to bottom. Most likely this speed issue comes from PHP, since PHP is simply slower than C etc.
4
6812
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form allows the employee to enter their UserID and select "Login" or "Logout" and then click a submit. When the submit button is clicked, I want the application to dum the NT Userename, UserID, status (Login or Logout) and a date/time stamp into an MS Access...
1
3608
by: cumupkid | last post by:
II am trying to create a form that will allow me to upload photos to a folder in the site root directory and add the information to the mysql db at the same time. I have created two forms, one that uploads to photo to the folder in the site root diorectory. One that uploads the info to mysql database. but... When I try to upload them both ways at the same time i cant get it. I am Including code for both pages i have working. Code for...
5
7270
by: brijesh1234 | last post by:
Dear Sir/Madam With a request I would like to submit that I am developing an application in PHP where I want to use the following features as 1. On a click button of a PHP page, a live web camera should appear and capture the photograph of a person 2. On clicking the save button, the image/photo should store in database. I am using backend as a MSSQL 2000. It is kindly requested to help me and guide please.
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.