Import of webp-files
-
For some time I have practised import of images in the webp-format instead of jpg. My images have always been reduced in bytes (by way of quality and literal size compared to original photo). Webp does this better than jpg.
I have also been an active user of the “Alt & Title Text / Description” fields, as well as “Tags”. I find that imported jpg-files usually keep such meta information intact. However, webp-files don’t. They merely insert the file name into the Title Text field.
Of course, this causes a huge extra job in manually (re-)inserting the missing information in uploaded files.
How do I fix this?
-
It is a while since I fully analysed and checked how the Alt, Title and Tags fields are filled, but here is what I have. Basically, the fields are filled from EXIF/IPTC data. The question is whether your webp files were saved to include EXIF/IPTC as the default is maybe not. The secondary question is whether WordPress/Nextgen can access EXIF within webp files but I would hope so.
If you follow the analysis below, then it would suggest that your webp files have no EXIF data thus causing Title/Description to default to taking the filename.
————————————–
Each image file in a NextGen gallery has three associated text fields – Alt, Title (Description) and Tags.
Alt is displayed when the user hovers over a thumbnail. Alt is populated during image upload from the field identified variously as:
- ExifTool fieldname: IPTC > ObjectName
- IrfanView fieldname: IPTC > Document Title
- Photoshop Elements File Info fieldname: IPTC > Status > Title.
If this first choice field is null, the second choice is to populate Alt from the field used for Title (see next). In this case, Alt and Title will acquire the same data.
If the second choice is also null, then the final choice is to populate Alt using the file name with any blanks filled with ‘-‘.
Title is displayed under the thumbnail and when the user clicks on a thumbnail and the image is displayed in a pop-up. Title is populated during image upload from the field identified variously as:
- ExifTool fieldname: IPTC > Caption-Abstract
- IrfanView fieldname: IPTC > Caption (Description)
- Photoshop Elements File Info fieldname: IPTC > Content > Description
If this field is null, the default Title is null.
Tags is populated during image upload from the field identified variously as:
- ExifTool fieldname: IPTC > Keywords
- IrfanView fieldname: IPTC > Keywords
- Photoshop Elements File Info fieldname: IPTC > Content > Keywords.
If this field is null, the default Tags is null.
Thank you for the response. I seems that my process of shrinking and converting the image files, strips them for IPTC data. The result seem alright in the File Manager, with the title and descriptions fields as well as codes/tags. When I look up EXIF data in IrfanView they include ImageDescription and TXTitle.
So perhaps NextGen is not able to read EXIF data? Is IPTC the clue here?
I have previously used IrfanView to shrink and convert images. However, it doesn’t include any meta data at all. Then I started to use XnView which seemingly rendered EXIF-data unchanged. What next?
I have checked saving a webp file with both IrfanView and Faststone Viewer. Neither has an option to include EXIF/IPTC data in the saved file. Examining files saved from both, neither appears to have EXIF/IPTC data. My (old) copy of Affinity will open webp files but is not able to export that format so I cannot test that.
Anyway, the answer to your original question is that the files you are uploading do not contain the fields required to populate Nextgen in the way you would like.
My usual work flow in XnView produces a result with some metadata, but not in the format that NGG imports. So I (also) asked ChatGPT for a solution. I am now able to pick up the XnView generated webp files and run them through Exiftool. This moves the exported data into fields NGG is able to import. I don’t touch the original files, only the webp files temporarily stored in a separate folder locally. It works smoothly. Here is the command:
“C:\program files\ExifTool\exiftool.exe” -overwrite_original “-XMP-dc:Title<XPTitle” “-XMP-dc:Description<XPTitle” “-XMP-dc:Subject<XPKeywords” “C:\path\to\temporary folder”
The only thing is that two or more tags in a picture do not split into comma separated values, but stays with a semicolon. NGG simply imports it as a new tag. On the other hand, multiple tags for the same picture are rarely the case in my library and is easy to fix in NGG after upload.
I didn’t know if you had ExifTool, but I also use it to preprocess my jpg files. I didn’t know it could manage webp files.
In my case I want Alt to be the original filename (not the blank filled modified version after upload). And I want Title and Tags to be clear. I have an immediate command in ExifTool to do that. My Title information is specific for each file and I add it manually in Nextgen.
Hi @sandalsand ,
Thanks for posting the ExifTool step you worked out. That will help other people who convert to WebP. And thanks to @mbsharp for the detailed field map.
Looks like you found the real cause. When NextGEN Gallery imports an image, it looks for text in three kinds of metadata, in this order: XMP, IPTC, then EXIF. The IPTC and EXIF readers we use only understand JPEG (and TIFF). In a WebP file they find nothing. The XMP reader is different: it scans the whole file for an XMP block, so it works for WebP as well.
That’s why your JPEGs kept their text and your WebP files didn’t. XnView writes your title and keywords into the Windows fields (XPTitle and XPKeywords), which live inside EXIF. NextGEN Gallery reads those fields from a JPEG but can’t reach them in a WebP. With nothing found, the Alt & Title Text falls back to the file name. Copying the values into the XMP “dc” fields puts them where NextGEN can read them in any format. Your mapping also matches what NextGEN expects: XMP Title becomes the Alt & Title Text, XMP Description becomes the Description, and XMP Subject becomes the Tags.
The semicolon problem comes from how the tags get built. NextGEN Gallery takes the keyword list and splits it on commas only. Windows stores XPKeywords as one text value with semicolons between the words, and ExifTool copies that text across as a single keyword. So “beach;sunset” ends up as one tag. ExifTool has a separator option, -sep, that tells it to split a value into separate list items as it writes. If you add -sep with a semicolon as the separator to the command you’re already running, each keyword should arrive as its own entry in XMP Subject. NextGEN Gallery will then create a separate tag for each one. It’s worth testing on a copy or two first to make sure the tags split the way you expect.
I’ll also pass this along to the team as a feature request. Right now NextGEN Gallery can’t read the Windows title and keyword fields from WebP files, and it doesn’t split tags on semicolons. I can’t promise a timeline, but your write-up shows clearly why both would help.
Best,
Mihai
You must be logged in to reply to this topic.