问题
I'm trying to change the 'title' (extended file attribute) in multiple photos using Taglib-Sharp in Powershell. While it works fine for most, it doesn't for certain photos. So far from my initial testing it appears to not work with Olympus produced JPEG's or JPEG's without any EXIF info in them at all.
I'm using TagLib-Sharp 2.1.0.0, I've tried older version's too.
This is my code:
[Reflection.Assembly]::LoadFrom( ("c:\taglib-sharp.dll") )
$media = [TagLib.File]::Create("C:\temp\photo.jpg")
$media.ImageTag.Title = "Test Title"
$media.save()
This is the error I get:
PS C:\Users\tris> C:\Write_tag_taglib-sharp.ps1
GAC Version Location
--- ------- --------
False v2.0.50727 c:\taglib-sharp.dll
Exception calling "Save" with "0" argument(s): "File not writeable. Corrupt metadata?"
At C:\Write_tag_taglib-sharp.ps1:4 char:1
+ $media.save()
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
The photos all appear fine and I can manually set the TITLE
without issue in Windows Explorer.
I've no prior experience in this area and am new to Powershell - can anyone help?
来源:https://stackoverflow.com/questions/16654469/powershell-set-title-in-photo-file-using-taglib-sharp-not-working