tag:blogger.com,1999:blog-746726189537118047.post7693292930172455252..comments2023-07-12T15:27:51.375+10:00Comments on Occasional Utility: How to Add a Timestamp to Photos after they've been downloadedBen Hasletthttp://www.blogger.com/profile/13473217184605706502noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-746726189537118047.post-78402698492857318452013-05-15T09:33:15.521+10:002013-05-15T09:33:15.521+10:00I'm also using this method to insert the date/...I'm also using this method to insert the date/time to screenshots I've taken. As it's normally just one photo at a time, I use the add text feature instead of batch processing.<br /><br />1/. Draw a box on the image where you want the text<br />2/. Hit CTRL+T to open the text edit box<br />3/. For Date/Time of the file, add $T in the 'text' box or use the code above for EXIF data.<br />4/. CTRL+S to Save<br />xbmcnuthttps://www.blogger.com/profile/01810815406555210279noreply@blogger.comtag:blogger.com,1999:blog-746726189537118047.post-30501650537035303522013-05-13T12:33:02.031+10:002013-05-13T12:33:02.031+10:00Sorry to hear that. Is it possible that the images...Sorry to hear that. Is it possible that the images you are working on have no data in the EXIF TAG?<br /><br />This guy seems to have an EXIF TAG viewer http://regex.info/exif.cgi<br /><br />Let us know if this shows you anything in the time stamp fields.Ben Hasletthttps://www.blogger.com/profile/13473217184605706502noreply@blogger.comtag:blogger.com,1999:blog-746726189537118047.post-51906262753840523442013-01-07T15:06:16.912+11:002013-01-07T15:06:16.912+11:00Ben, this doesn't work for me.
It creates a co...Ben, this doesn't work for me.<br />It creates a copy of the photo wherever I tell it to, but it doesn't make any change to the photo...I tried a million variations of this and nothing worked.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-746726189537118047.post-65121407158964065982010-02-22T10:14:13.038+11:002010-02-22T10:14:13.038+11:00That's a great call Chris.
So thinking about ...That's a great call Chris.<br /><br />So thinking about that... Could we watch a folder for new images and then run that script on them?Ben Hasletthttps://www.blogger.com/profile/13473217184605706502noreply@blogger.comtag:blogger.com,1999:blog-746726189537118047.post-80523682485072718772010-02-19T23:49:19.713+11:002010-02-19T23:49:19.713+11:00Thought I'd stick my oar to say that this task...Thought I'd stick my oar to say that this task can also be automated/batched with PowerShell, without any 3rd party tools. Just run the function below in PowerShell, then pass the function an array of file objects...<br /><br />Example:<br />PS C:> Get-ChildItem "C:\Users\Chris\Desktop\test\*" -include *.jpg | Foreach-Object{Add-EXIFDataToImage $_}<br /><br />###############################<br /><br />function Add-EXIFDataToImage {<br /><br />param($image)<br /><br />add-type -AssemblyName system.drawing<br /><br />function Get-EXIFData {<br /><br />param($filePath)<br /><br /> $imageEXIF = New-Object -TypeName system.drawing.bitmap($filepath)<br /> [byte[]]$bytes = $imageEXIF.Getpropertyitem(36867).value<br /> if ($bytes.count -gt 0){<br /> $ASCIIEnc = [System.Text.Encoding]::ASCII<br /> $DateTimeString = $ASCIIenc.GetString($bytes)<br /> $arrDateTime = $DateTimeString.split(" ")<br /> return [datetime]"$($arrDateTime[0].replace(":","-")) $($arrDateTime[1])"<br /> }<br /> else<br /> {write-host "$filePath contained no 'DateTaken' information"}<br />}<br /><br /><br />function Add-DatetoImage {<br /><br />param(<br />$fileName,<br />$string<br />)<br /><br /> $parent=split-path $_.fullname<br /> $newFileName = join-path -Path $parent -ChildPath "$($_.basename)_new$($_.extension)"<br /><br /> $objImage = [system.drawing.image]::FromFile($fileName)<br /> $objCanvas = [system.drawing.Graphics]::FromImage($objImage)<br /> $objImage.SetResolution(72,72)<br /> [single]$DesiredWidth = $($objImage.Width) * .25<br /> $objFont = new-object system.drawing.font([system.drawing.fontfamily]"Verdana",12,[system.drawing.fontstyle]"Bold")<br /> $StringSizeF = $objcanvas.MeasureString($string, $objFont)<br /> [single]$ratio = $StringSizeF.Width / $objFont.SizeInPoints<br /> $requiredFontSize = $DesiredWidth / $ratio<br /><br /> $objFont = new-object system.drawing.font([system.drawing.fontfamily]"Verdana", $requiredFontSize,[system.drawing.fontstyle]"Bold")<br /> $objBrush = new-object system.drawing.SolidBrush([system.Drawing.Color]::FromArgb(128, 255, 0, 0))<br /> $objcanvas.DrawString($string,$objFont,$objBrush,0,0)<br /><br /> $objImage.Save($newfileName)<br /><br />}<br /><br />$DateTaken = Get-EXIFData $image.fullname<br />Add-DateToImage $image.fullname $DateTaken<br /><br />}Anonymoushttps://www.blogger.com/profile/06502127939551331427noreply@blogger.com