easy-thumbnails icon indicating copy to clipboard operation
easy-thumbnails copied to clipboard

Preserve EXIF data when using resize_source

Open nuschk opened this issue 9 years ago • 4 comments

We're using the (awesome) resize_source option to limit user provided images to a reasonable size when uploading. Our options are:

`{'size': (1400, 1400), 'crop': False, 'upscale': False, 'quality': 90}``

Now I've noticed that all EXIF data is lost in the process. Would it be possible to fix this behavior, and would that even be desirable? Unfortunately, I haven't read the source very intimately, but I'd be willing to provide the PR if it's feasible.

nuschk avatar Jan 20 '16 10:01 nuschk

I'm not sure you can keep the exif data. PIL loses this data as soon as it transforms the image. What's the issue with losing this data - is it something fundamental like rotation?

SmileyChris avatar Jan 21 '16 21:01 SmileyChris

Nothing fundamental, no. I think PIL is already applying orientation info correctly when resizing.

It's just that we would like to look up a few things way after the images have been uploaded by the user (GPS coordinates for example). I'm currently doing it by storing the EXIF data in a separate json field before the image is passed to the ThumbnailerImageField, which is an ok solution for me.

If that's the first time this request came up, it probably means it's really an edge case, though.

nuschk avatar Jan 22 '16 06:01 nuschk

@nuschk I'm quite happy the PIL removes EXIF data. It can contain information, I often do not want to expose (for instance camera type, GPS coordinates, etc.). You are further encouraged to reduce the size of images using tools such jpegoptim or optipng. They would remove that information anyway.

jrief avatar Jan 22 '16 07:01 jrief

Yeah, that's a use case, too, I suppose. And, I'm completely fine that I don't have any infos on the thumbnails. I'm just referring to the original image, which, I presume, will keep the EXIF data when I don't use resize_option at all. So, the behavior is not terribly consistent...

But, again, I can see that mine is a very special view on the matter and that it doesn't apply for most people.

nuschk avatar Jan 22 '16 09:01 nuschk