HUGO

Option to strip EXIF data from images upon build

I would love to see the option to have HUGO remove EXIF metadata from my images when they are added to my public directory upon build. This data can contain stuff like the GPS coordinates of the image, and make, model, and software version of phone, which is information that a user might not want to be public / is unnecessary.

This seems to be relatively inline with HUGO’s objectives and goals considering existing features. HUGO already allows for post processing of resource files with the --minify option, so this would be a relatively similar endeavor. Instead of finding .js, .html, and .css files, the HUGO build tools would find .jpg and .tiff files. And then just like those files are passed to a minification function before being output to the public directory, images would be de-exified before being output to the public directory.

I imagine this behavior could be configured either by a build-time flag (eg: --removeEXIF) or configured through the configuration file. Additionally, this could be implemented as an all or nothing option (either you keep whatever EXIF data your images have or you get rid of all of it), or you could specify specific values to keep or remove, similarly to how the regex matching works in config.imaging.exif:

imaging:
  exif:
    includeFields: ""
    excludeFields: ".*"

However, the above config seems to only control what HUGO pays attention to or not, as all the EXIF data is still present in the copied images.

While I have experience with software development I haven’t used GO before and I also have no knowledge of HUGO’s codebase so I’m not sure how well I’d be able to implement a feature like this, but I hope that for a skilled developer it should be a straightforward addition.

Not commenting on the suggestion itself, you can currently:

  • Tell Hugo not to publish images that lives inside /content
  • If you process those images with one of Hugo’s many functions and filters, the Exif is gone.
1 Like