The following procedure can be used to add a Visual Timestamp to an image;
Install IrfanView
Install IrfanView plugins on the same page
- Load Iview
- Click file
- Click batch conversion/rename
- Add files that need to be stamped
- check on Use advanced options
- click set advanced options
- check on Add Overlay text
- click settings
- Make sure we've set text box Width 3648 height 2736
- Enter the EXIF TAG Value of the Date Taken TAG ( $E36867)
- Set the font to something inteligent (Calibri 48 Bold Green)
- Click OK
- Click Ok
- Click Start
Happy days. If legal boffins decide to challenge the validity of the timestaps we can provide them with the original files and they can check the date tags themselves.
UPDATE 14/05/2013 - Saw this is by far the most visited blog post I've made. So cleaned it up and removed referenced to user permissions this post assumes you have admin rights.
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...
ReplyDeleteExample:
PS C:> Get-ChildItem "C:\Users\Chris\Desktop\test\*" -include *.jpg | Foreach-Object{Add-EXIFDataToImage $_}
###############################
function Add-EXIFDataToImage {
param($image)
add-type -AssemblyName system.drawing
function Get-EXIFData {
param($filePath)
$imageEXIF = New-Object -TypeName system.drawing.bitmap($filepath)
[byte[]]$bytes = $imageEXIF.Getpropertyitem(36867).value
if ($bytes.count -gt 0){
$ASCIIEnc = [System.Text.Encoding]::ASCII
$DateTimeString = $ASCIIenc.GetString($bytes)
$arrDateTime = $DateTimeString.split(" ")
return [datetime]"$($arrDateTime[0].replace(":","-")) $($arrDateTime[1])"
}
else
{write-host "$filePath contained no 'DateTaken' information"}
}
function Add-DatetoImage {
param(
$fileName,
$string
)
$parent=split-path $_.fullname
$newFileName = join-path -Path $parent -ChildPath "$($_.basename)_new$($_.extension)"
$objImage = [system.drawing.image]::FromFile($fileName)
$objCanvas = [system.drawing.Graphics]::FromImage($objImage)
$objImage.SetResolution(72,72)
[single]$DesiredWidth = $($objImage.Width) * .25
$objFont = new-object system.drawing.font([system.drawing.fontfamily]"Verdana",12,[system.drawing.fontstyle]"Bold")
$StringSizeF = $objcanvas.MeasureString($string, $objFont)
[single]$ratio = $StringSizeF.Width / $objFont.SizeInPoints
$requiredFontSize = $DesiredWidth / $ratio
$objFont = new-object system.drawing.font([system.drawing.fontfamily]"Verdana", $requiredFontSize,[system.drawing.fontstyle]"Bold")
$objBrush = new-object system.drawing.SolidBrush([system.Drawing.Color]::FromArgb(128, 255, 0, 0))
$objcanvas.DrawString($string,$objFont,$objBrush,0,0)
$objImage.Save($newfileName)
}
$DateTaken = Get-EXIFData $image.fullname
Add-DateToImage $image.fullname $DateTaken
}
That's a great call Chris.
ReplyDeleteSo thinking about that... Could we watch a folder for new images and then run that script on them?
Ben, this doesn't work for me.
ReplyDeleteIt 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.
Sorry to hear that. Is it possible that the images you are working on have no data in the EXIF TAG?
DeleteThis guy seems to have an EXIF TAG viewer http://regex.info/exif.cgi
Let us know if this shows you anything in the time stamp fields.
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.
ReplyDelete1/. Draw a box on the image where you want the text
2/. Hit CTRL+T to open the text edit box
3/. For Date/Time of the file, add $T in the 'text' box or use the code above for EXIF data.
4/. CTRL+S to Save