ImageMagick / ImageMagick

🧙‍♂️ ImageMagick 7
https://imagemagick.org
Other
11.98k stars 1.35k forks source link

cannot update image title #6946

Closed FredVz closed 9 months ago

FredVz commented 9 months ago

ImageMagick version

7.1.1-23 Q16 HDRI x64

Operating system

Windows

Operating system, version and so on

Windows 11 Family 22H2

Description

Hello all, I MUST update title and legend of 1660 jpg files... no choice. I'm not a good developper (was some decades ago) I ran a PowerShell script as admin in Windows 11 to update one file ttitle as a first try. The script runs with no error but my jpg title is NOT modified :( I already spent days trying to find a solution, Majick seemed to be the best candidate but... I'm crying :D

Thanks a million if you can solve my issue :) - Fred

Steps to Reproduce

PS C:\WINDOWS\system32> $imageFilePath = "D:\ALFBXL\essai2\ev1908.jpg"

echo $imageFilePath

D:\ALFBXL\essai2\ev1908.jpg PS C:\WINDOWS\system32> $newTitle = "Nouveau Titre ev1908"

PS C:\WINDOWS\system32> echo $newTitle

Nouveau Titre ev1908 PS C:\WINDOWS\system32> if (Test-Path $imageFilePath -PathType Leaf) { magick $imageFilePath -set title "$newTitle" $imageFilePath Write-Host "Titre de l'image mis à jour avec succès : $newTitle" } else { Write-Host "Le fichier image n'a pas été trouvé : $imageFilePath" }

Titre de l'image mis à jour avec succès : Nouveau Titre ev1908 PS C:\WINDOWS\system32>

Images

image

snibgo commented 9 months ago

Please show or link to a JPG file that has a title.

FredVz commented 9 months ago

ev1908

FredVz commented 9 months ago

image

snibgo commented 9 months ago

I can't download the JPG for some reason. Can you zip it, and upload the zip file?

dlemstra commented 9 months ago

The maximum dimensions of a jpeg file are 65535x65535. Is your output image within these limits?

FredVz commented 9 months ago

dlemstra Yes ! all files are small and light weight on purpose - they were on a web site and we need to upload them to a WP new site;. You can see th size of this one on the capture of the file properties windows.

snibgo thanks for your help again here is the zip. ev1908.zip

snibgo commented 9 months ago
C:\web\im>exiftool -G0 -args ev1908.jpg |grep -i title
-EXIF:XPTitle=evenement 1908 prem titre pour test
-XMP:Title=evenement 1908 prem titre pour test

So we have two titles. One is EXIF, the other is XMP.

I suggest you change these using exiftool:

exiftool -XMP:title="New XMP title" -EXIF:XPTitle="new exif title" e.jpg

Verify the changes:

C:\web\im>exiftool -G0 -args e.jpg |grep -i title
-EXIF:XPTitle=new exif title
-XMP:Title=New XMP title
FredVz commented 9 months ago

Thanks a lot indeed Snibgo. I could succesfuly update picture's headline and caption with .\exiftool.exe -charset IPTC=UTF8 -IPTC:Headline="$name" -IPTC:Caption-abstract="$caption" $name".jpg"

Last and big problem exiftool does not understand multiple lines captions - neither with CAR(10) nor 😢

snibgo commented 9 months ago

See exiftool --help. The "-ec" option does the trick:

exiftool -ec -XMP:title="New XMP\ntitle" e.jpg

The title now contains the newline character.

FredVz commented 9 months ago

Thanks Snibgo, my multiline caations are in :) :)