coralnet
coralnet copied to clipboard
Annotation tool: Handle EXIF orientation in PNG images
Branched off from my write-up in issue #107.
The annotation tool currently downloads the image to annotate, then strips the EXIF orientation from the in-memory image, then loads the edited image into the canvas so that it appears un-rotated (thus matching the point positions). The EXIF editing is done with a Javascript plugin called piexifjs. piexifjs doesn't recognize EXIF in PNG yet.
EXIF was added to the PNG spec in July 2017, but it's not that widely supported in software yet. It IS possible to create a PNG with EXIF orientation in current versions of Pillow (starting in 6.0.0). But I then tried viewing the image in Firefox and Chrome, and they did not respect the EXIF orientation.
For this issue to become a real problem, I suppose the following would have to happen:
- Browsers would have to start respecting EXIF orientation in PNG.
- Cameras which produce PNG images with EXIF orientation would have to become somewhat common.
As we now know, if this sort of problem sneaks up on us, it IS a real pain. But it doesn't seem like the danger is imminent yet.
Sounds like we're safe for now, and just sit on it until the bug reports come in ... if they ever do.
On Sat, Jun 13, 2020 at 7:55 PM StephenChan [email protected] wrote:
Branched off from my write-up in issue #107 https://urldefense.com/v3/__https://github.com/beijbom/coralnet/issues/107__;!!Mih3wA!RQc4eXMcpb1i90E9HjPgwc2CS5RqgPMCZpNFlA8lXZw_I7rkpS4G4Ku-sPWds_oH$ .
The annotation tool currently downloads the image to annotate, then strips the EXIF orientation from the in-memory image, then loads the edited image into the canvas so that it appears un-rotated (thus matching the point positions). The EXIF editing is done with a Javascript plugin called piexifjs. piexifjs doesn't recognize EXIF in PNG yet.
EXIF was added to the PNG spec in July 2017 https://urldefense.com/v3/__https://stackoverflow.com/a/9576717/__;!!Mih3wA!RQc4eXMcpb1i90E9HjPgwc2CS5RqgPMCZpNFlA8lXZw_I7rkpS4G4Ku-sPR65ELC$, but it's not that widely supported in software yet. It IS possible to create a PNG with EXIF orientation in current versions of Pillow (starting in 6.0.0). But I then tried viewing the image in Firefox and Chrome, and they did not respect the EXIF orientation.
For this issue to become a real problem, I suppose the following would have to happen:
- Browsers would have to start respecting EXIF orientation in PNG.
- Cameras which produce PNG images with EXIF orientation would have to become somewhat common.
As we now know, if this sort of problem sneaks up on us, it IS a real pain. But it doesn't seem like the danger is imminent yet.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/beijbom/coralnet/issues/331__;!!Mih3wA!RQc4eXMcpb1i90E9HjPgwc2CS5RqgPMCZpNFlA8lXZw_I7rkpS4G4Ku-sDHfLz7L$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABKA5AMWZI2OC77B3QEPBDDRWQ3ZFANCNFSM4N5IALNQ__;!!Mih3wA!RQc4eXMcpb1i90E9HjPgwc2CS5RqgPMCZpNFlA8lXZw_I7rkpS4G4Ku-sD4hAuTA$ .