aws-lambda-image
aws-lambda-image copied to clipboard
Auto orientation bug
Everything works great but if I convert a portrait image I get it back as landscape, probably use auto-orient parameter for ImageMagick?
This package uses lambda's installed Imagemagick, with no options. Probably, convert image taken by iOS's camera?
I recognize image orientation bug on iOS like this: http://stackoverflow.com/questions/10600613/ios-image-orientation-has-strange-behavior
It can fix iOS rotation bug, but I have not fix on this package. If not taken by iOS, it was strange...
How can we fix this? It is vary bad.
Looks like the problem is the EXIF data is stripped off of the original image.
@ysugimoto is there any way to keep this data with the resulting images?
@sbiermanlytle Unfortunately, how to leave the EXIF data seems to be no.
But, It is able to fix the rotation that check the EXIF data before reducing with identify
command, and prepareing rotation image at Imagemagick.
@ysugimoto I just wanted to ask if you can commit a fix for the orientation bug? :)
There are a couple of places that describe what needs to be done "in the processing pipeline" to apply this fix: stackoverflow and lwip
Based on that I think that it's just a matter of wiring that code into this module and applying it, probably as an option if not the default.
@ysugimoto are you open to a pull request if I do this? What are your thoughts on where it should go in the code?
@guyellis Sure, I welcome the PR!
If it learn to lwip, I think this process:
- Get orientation from EXIF, and save it (
ImageData
class property is the good place) - Reduce image
- Rotate image from saved orientation angle
But, rotate image after reduce, perhaps it present some data innner image... Please let also hear your thoughts.
@ysugimoto I ended up creating my own Lambda function from scratch which you can find here. The relevant line that flips the orientation is this one. Not sure if that's enough information for you to fix and close this issue?
@ysugimoto any updates?
@guyellis With your code, do you no longer experience the orientation bug from files uploaded via phone?
-- Just realized why I feel like this wasn't working: I'm reducing the primary file and creating thumbnails using resize-well reduce doesn't call autoOrient or anything relating (#123)
@jaketoolson from what I remember that line I referenced above fixes the issue. I haven't done extensive testing from a phone yet. There still is an orientation bug that I haven't addressed in what I'm using and I'm not sure if it's related to this.