Support EXIF data with `resize_image`

The built-in resize_image function does not currently handle EXIF data. This causes two problems:

  • EXIF data is not copied over to the output image. This includes information like creator, copyright, camera information, geolocation (though removing that may be desirable), etc
  • If the image relies on an EXIF “Orientation=” tag to define its display rotation (portrait/landscape), then op="fit*" will misinterpret the aspect ratio, resulting in a stretched image.

It might be that supporting EXIF is outside the scope of a utility like resize_image and the right solution is to preprocess images outside of zola to “bake in” rotation, but I’m curious if others have run into this and if folks have opinions on whether supporting EXIF would be appropriate.

Specifically, the feature request would be:

  • resize_image should copy EXIF data from input to output, changing tags as appropriate for the resized image’s dimensions and quality
  • resize_image should take into account the “Orientation” tag to determine aspect ratio when applying a “fit” operation

We do have zola/components/imageproc/src/helpers.rs at master · getzola/zola · GitHub so if it’s not working well for the fit operation it should be a bug to fix