Created
June 21, 2020 17:00
-
-
Save ngollan/a97da17ee7e591f1ee214df3e864f1d8 to your computer and use it in GitHub Desktop.
Convert Elite Dangerous screenshots to PNG and set creation date as XMP metadata.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem "$([Environment]::GetFolderPath("MyPictures"))\Frontier Developments\Elite Dangerous" -Filter "*.bmp" | | |
Foreach-Object { | |
$dir = $_.DirectoryName | |
$base = $_.BaseName | |
$originalDate = $_.CreationTimeUtc | |
$destination = "$($dir)/PNG/$($base).png" | |
$result = "" | select name, converted, setMetadata | |
$result.name = $base | |
$result.converted = $false | |
if (!(Test-Path -Path $destination)) { | |
# Write to PNG with an embedded sRGB profile. | |
D:\bin\ImageMagick\convert.exe $_.FullName -profile D:\sRGB2014.icc "$($dir)/PNG/$($base).png" | |
$result.converted = $true | |
} | |
# Write the original file creation date as XMP metadata. That is what Adobe Bridge seems to react to best, | |
# and it is not impossible to read back later. Fractional seconds appear to get dropped, but wo really cares. | |
$originalDateString = $originalDate | Get-Date -Format "yyyy:MM:dd HH:mm:ss.ff\Z" | |
D:\bin\exiftool.exe -q -if 'not defined $xmp:dateTimeOriginal' -xmp:dateTimeOriginal="$($originalDateString)Z" $destination | |
$result.setMetadata = $? | |
$result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assumes ImageMagick executables in
D:\bin\ImageMagick\
andD:\bin\exiftool.exe