Keep EXIF data for resized images

Hi folks,
I’m using Ghost as photography blog for myself since years. When I’ve tried to put some EXIF information next to the images, I noticed, that the EXIF data was removed during resize. Is this behavior by intention? Keeping the EXIF data is a one-liner, I can create a pull request for it if I get a consensus about that topic. Are there any objections or concerns?

Best regards,
Henning

Hi @henningrck,

EXIF data is automatically removed as part of the image optimisation process. Optimisation can be disabled in the config.[environment].json file (if you self-host), but as far as I’m aware, it’s either all three compression steps or nothing (so, the removal is intentional).

1 Like

I see. I didn’t know about that. But still: This would only keep the EXIF data only on the original, uncompressed image. Since there’s no possibility to read the EXIF data on server side, I have to read it on client side, which means I have to load the full-sized, uncompressed original image. It would be much faster to read the EXIF data from a thumbnail image, because it’s file size is way smaller.

But as it’s documented in the way that the meta data gets removed, this may be a breaking change. Anyway, if you also want to address photographers with Ghost, this would be a fantastic improvement.

Best regards,
Henning

The EXIF data removal is intentional, both for privacy considerations (many people are not aware that their location and other details may be present in photos they upload) and for optimisation. On the optimisation side, it’s not infrequent that images contain thumbnails in the EXIF data or large ICC profiles that are not useful for web display - it wouldn’t be very good for optimisation if we resized to a thumbnail but ended up keeping an even larger unoptimised thumbnail in the EXIF data :grimacing:

It may be that we can be more selective in the EXIF data that is kept, things like copyright info etc would be generically useful.

2 Likes

Makes sense. I believe being more selective on which EXIF data will be kept will lead to requests like “please also keep property XY of the EXIF data”. I’m not sure who decides which data will be kept.

Alternatively would it be an option to make the image optimization more configurable? Currently you can only turn it on and off. Additionally we could add configuration options like:

  • imageOptimization.format (string, defaults to “jpg”)
  • imageOptimization.jpgQuality (number, defaults to 80)
  • imageOptimization.keepMetadata (boolean, defaults to false)
  • imageOptimization.maxWidth (number, defaults to 2000, may be overwritten by image sizes defined in the package.json)

Anybody who wants to keep the EXIF data could set imageOptimization.keepMetadata to true. As it’s turned off by default, there shouldn’t be any concerns in terms of privacy.

1 Like