Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic image rotation based on EXIF data. #12

Closed
wants to merge 6 commits into from

Conversation

ezvirtual
Copy link
Member

This was previously supported in ATContentTypes and a discussion in p.a.contenttypes lead to the suggestion that this was the best place to re-implement the functionality.

Plone.app.contenttypes issue with discussion on the subject
[@maartenkling's post on adding this functionality for dexterity images (https://www.fourdigits.nl/blog/auto-rotate-dexterity-images-based-on-exif-info)

I originally added a subscriber for Archetypes images however the current code needs changing to use Archetypes accessor methods.

I'm relatively not quite sure on the correct protocol around this process - this is my first contribution to plone core - I'm more than happy to receive any hints / feedback!! 😃

@ezvirtual ezvirtual closed this Sep 15, 2015
@maartenkling
Copy link
Member

i like, why close it?

@maartenkling
Copy link
Member

never mind #13

loechel added a commit that referenced this pull request Sep 21, 2016
PLIP 1673: plone/Products.CMFPlone#1673
This PLIP implementation introduced a straight foreward image rotation based on Exif information for JPEG and TIFF Images stored in plone.namedfile Image fields.
The concept of Exif orientation is described in detail in the following blog: http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/

It requires an additional external library as dependency: piexif (package: https://pypi.python.org/pypi/piexif; docs: http://piexif.readthedocs.org/en/latest/; github: https://github.com/hMatoba/Piexif)
piexif, allows reading and writing of Exif information, which offers more powerful image handling than a read only library. piexif also works very smart together with Pillow.

This PLIP superseeds prior attemts to add Exif based image rotation to plone.namedfile: #12, #13, #14

For testing of orientation change, images where needed to include for test files.
This is not part of this implementation.
The following github repositories have several examples of Images for orientation testing:
* https://github.com/recurser/exif-orientation-examples (JPEG Images with orientation 1-8 in Landscape and Portrait orientation)
* https://github.com/ianare/exif-samples (lots of different JPEG and TIFF Images, even corrupted images)

Additional to the PLIP implementation this commit includes a restructuring of the package.
* Image meta data detection has been moved to a subfolder utils and splited into several files for each image type
* Moved functions to utils as those are helper methods, so that base functionallity is easier to read
* Added basic TIFF Image handling. Prior TIFF were handled as Files not Images.

Last but not least:
Moved package version from 4.1.x to 4.2.0 as it introduced new features, following semantic versioning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants