ImageMagick needs to be installed, including legacy tools, and in the path
Takes files with the format yyyyMMdd.jpg in the current directory, and adds a stamp to the bottom-right corner in the MMM dd yyyy format. Creates a new file named “stamped.yyyyMMdd.jpg”
$MagickExe = "magick" Get-ChildItem -Filter *.jpg | Sort-Object -Property Name | ForEach-Object { $BaseFileName = [System.IO.Path]::GetFileNameWithoutExtension($_.Name) [ref]$PicDate = [DateTime](Get-Date) $Provider = [System.Globalization.CultureInfo]::InvariantCulture $Style = [System.Globalization.DateTimeStyles]::None if ([DateTime]::TryParseExact($BaseFileName, "yyyyMMdd", $Provider, $Style, $PicDate)) { $FormattedDate = $PicDate.Value.ToString("MMM dd yyyy") $Arguments = "convert" ` + " -verbose" ` + " $($_.Name)" ` + " -gravity SouthEast" ` + " -font Arial" ` + " -pointsize 81" ` + " -fill white" ` + " -stroke black" ` + " -annotate +81+81" ` + " `"$FormattedDate`"" ` + " stamped.$BaseFileName.jpg" Start-Process -FilePath $MagickExe -ArgumentList "$Arguments" -Wait -NoNewWindow } }