Resize removes IPTC data?

Disclaimer: I’m a Hugo newbie, so please bear with me if I use the wrong terminology.

I’d like to use IPTC information (headline etc.) in an image gallery. The images are part of a page bundle. They are scaled down with .Resize and displayed in a regular grid by a partial. All this works just fine.
However, whereas the original image contains all the IPTC data, the one scaled down with .Resize does not. EXIF data is preserved, though.
I’m using exif-reader.js to get at the IPTC/EXIF data (since Hugo does only support EXIF right now).
If the removal of the IPTC data is intentional, it might be helpful if the documentation mentioned it.

There is no support for IPTC metadata in Hugo. The documentation mentions available features. If something is missing, then it is not supported.

I’d have expected that a .Resize function does exactly what it says: resizing the image data. Not more, i.e. remove data contained in the image at its leisure. Apparently, I’m wrong and have to think about side effects that are not explicitly mentioned.

@chrillek You are correct. Removal of image tags is not mentioned in the documentation, though I did find reference to the behavior here.

I’ve created an issue to update the documentation.

Please note that all tags are removed: EXIF, IPTC, XMP, etc. If you use something like exiftool to read the tags after image processing, it might look like some tags are retained, but the data displayed is extracted from the file and image properties–none of it is EXIF data.

Also note that the original file is untouched.

This Pull Request addresses the issue of the lack of documentation about IPTC removal in resized images and mentions that users can access meta from the original file.

Therefore I have marked the above post as the solution to this topic, since current behavior is unlikely to change as per the associated GitHub issue.

Thanks for putting the note in the documentation.
I’d like to clarify my reasons for asking about this (and I’m talking explicitly about IPTC data, not EXIF).
IPTC data comprises headlines, captions, keywords, copyright information and so on. All of this can be useful on a website. Simple example: If I can use the caption from the IPTC data, I do not have to provide the same again somewhere else (frontmatter, HTML, whatever). Don’t repeat yourself! There is, for example, a Wordpress plugin that programmatically populates the meta data fields in their database when images are uploaded.

Although it is possible to process the original file in Hugo and extract the data with JavaScript, it is cumbersome (or maybe it is only for me because I don’t know how to do better):

  • Either have the picture loaded twice (once as thumbnail in the img element, once the original for metadata extraction)
  • Or load the original file directly with Javascript and use the data as src attribute for the img elment and the metadata. In this case, the possibly much larger original file has to be loaded instead of maybe a small thumbnail.

Although this automatic removal has been dubbed a “privacy feature” in the GIthub thread, I beg to differ: IPTC data are not entered into the file automatically (as opposed to EXIF, which is written by the camera) but only by decision of the user. They are clearly not privacy related (title? caption? copyright?).
Many tools I know (Wordpress, image processing software) give the users a choice to keep or remove metadata in uploading, processing etc.

Typically these kind of features are brought into Hugo through third party native Go packages.

Not aware whether there is such a package for IPTC, and I do not have the time to look.

Try opening an issue with a feature request for adding IPTC support, at the main Hugo issues tracker and see whether you will get feedback by the maintainer.

The maintainer replied below.

We don’t remove it. Go’s image libraries does not add it/support it/preserve it. It was not an option to “keep it” (unless you expect me/us to spend another 1000 hours of dev time on a feature that, at least, I don’t need/want).

Same with IPTC. It would be nice, but it isn’t possible/practical.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.