aws-lambda-image icon indicating copy to clipboard operation
aws-lambda-image copied to clipboard

Auto orientation bug

Open vojtatranta opened this issue 8 years ago • 10 comments

Everything works great but if I convert a portrait image I get it back as landscape, probably use auto-orient parameter for ImageMagick?

vojtatranta avatar Apr 26 '16 16:04 vojtatranta

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...

ysugimoto avatar Apr 30 '16 06:04 ysugimoto

How can we fix this? It is vary bad.

ghost avatar Jun 25 '16 22:06 ghost

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 avatar Jul 18 '16 17:07 sbiermanlytle

@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 avatar Jul 19 '16 15:07 ysugimoto

@ysugimoto I just wanted to ask if you can commit a fix for the orientation bug? :)

ghost avatar Aug 13 '16 09:08 ghost

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 avatar Sep 08 '16 23:09 guyellis

@guyellis Sure, I welcome the PR!

If it learn to lwip, I think this process:

  1. Get orientation from EXIF, and save it (ImageData class property is the good place)
  2. Reduce image
  3. 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 avatar Sep 09 '16 04:09 ysugimoto

@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?

guyellis avatar Oct 01 '16 14:10 guyellis

@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 avatar Mar 16 '17 05:03 jaketoolson

@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.

guyellis avatar Mar 16 '17 16:03 guyellis