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.

3 Likes

I’m all for this, as I’m building a photo gallery page on my Ghost blog with PhotoSwipe and exif-js.

I’d rather stick to the Koenig image gallery component than hand-coding my HTML with titles and captions, but I realize the EXIF gets stripped away. I’d love it if we have a few more knobs for image optimization (instead of just resize, what @henningrck suggested above).

Would the core team entertain this if I can send a PR?

1 Like

For photography related blogs or people interested in image production, exif removing is not a good idea.

It should be configurable, yes.
It would be a good idea to provide options to remove just part of the exif data, like position or personal info.

Being able to configure it in the admin general settings interace (and quality and maxwidth) would be useful.

Are those options you talk about already implemented?
Where should we configure that?

I am using docker and docker-compose to install ghost, so I don’t have access to config files.
I suppose it can be configure in the docker-compose.yml through environment variables.

should I stablish an imageOptimization__keepMetadata: 1 variable in it?

As a photography site we prefer our images not to be touched by the system.
Is responsability of the user to optimize images to be viewed in the web.

If you compress an image, the focus of the image is lossed and needs to be refocused.
It may affect to other aspects of the image.

We prefer to have strict option limits in size (total MP or large border size in pixel) and maximum opupied space.

Is there an option to disable image optimization at all?

Of course thumnails and small versions of the images might be prepared compressing them, but the full blown image showed in a lightbox should be untouched and with full exif info.

I really consider it a problem, for me.
The quick fix I made was a line of exiftool directly into the folder

# exiftool -overwrite_original_in_place -creator="marting" -title="Mi Barrio" -copyright="marting" -url="https://martin.gersbach.net" *.jpg

best

For us the problem is the system deleting exifs or making weird optimizations.

When some body uploads a huge image it resizes and compresses the image too much.

Sometimes it comprrss them to 100KB
The image suffers a lot. It ends with noise and no focus at all.
It would be better to reject too big images and give a message to the user.

Exifs are umportant in images too.
It would be great that lightbox cpuld show exif data, and be able to select if you want to delete them.