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

Automatic image orientation based on EXIF is broken #733

Closed
mkondel opened this issue May 12, 2019 · 16 comments
Closed

Automatic image orientation based on EXIF is broken #733

mkondel opened this issue May 12, 2019 · 16 comments

Comments

@mkondel
Copy link

mkondel commented May 12, 2019

Expected Behavior

When processing any image, the intended orientation should be preserved.

Current Behavior

In the provided example, a portrait image gets saved in landscape. You can see the black bars that get added on left and right. The core image is oriented correctly inside, but the output file has the wrong dimensions.

Failure Information (for bugs)

Steps to Reproduce

  1. git clone https://github.com/mkondel/jimp-exif-text.git
  2. yarn
  3. yarn start
  4. look at input.jpg and output.jpg

Screenshots
I have screenshots in the repo linked above ^^.

Context

I am using Jimp with excellent result on AWS Lambda. This bug is not related to that at all, as it can be replicated locally.

  • Jimp Version: v0.6.4
  • Operating System: Linux (Fedora)
  • Node version: v8.12.0

Failure Logs

@m-jiang
Copy link

m-jiang commented May 21, 2019

I am also experiencing this issue, which is quite crippling for any application that allows users to upload an image from their device and camera.

This issue has noting to do with the rotate function (yet). As in the sample code provided by @mkondel, simply loading and writing the image will already deform it.

@mkondel
Copy link
Author

mkondel commented May 21, 2019

I fixed my issue by using another lib called jpeg-autorotate. Please checkout my repo above for a working demo. I use this lib before JIMP to "burn in" the rotation.

const fileIn = fs.readFileSync('input.jpg')
const jo = require('jpeg-autorotate')
const {buffer} = await jo.rotate(fileIn, {quality: 30})
const image = await Jimp.read(buffer)

@mkondel mkondel closed this as completed May 21, 2019
@grnch
Copy link

grnch commented Aug 28, 2019

Not sure why @mkondel closed this, the problem is still present in JIMP 0.6.4 (the latest version as of this comment).

Can we get this ticket reopened to get a proper fix, without external workarounds?

@DjulLau
Copy link

DjulLau commented Sep 6, 2019

I agree with @grnch : it would be great if this could be fixed in Jimp.

I've struggled with this for hours yesterday wondering what I was doing wrong.
jpeg-autorotate works but you have to add another module and understand how it works (for exemple it will throw an error (!) if no rotation has to be done so you need another code path to handle this case...).

@popinguy
Copy link
Contributor

It has been broken by 829b7d2 commit I suppose. In index.js the false flag has been added to rotate calls, which led to unchanging dimensions during rotation. I've opened PR

@sesam
Copy link

sesam commented Jan 29, 2020

The fix is merged 🎉 and was released in v0.8.5 🚀

So can this ticket be closed?

@mixdesign
Copy link

@oliver-moran I think this is broken again in v0.14.0 (maybe before)

@VolodymyrKornetskyi
Copy link

The same issue with v0.14.0

@LeonardodeLima
Copy link

this issue with v0.16.1

@dosomder
Copy link

dosomder commented Nov 8, 2020

Any news?

@rwichmann
Copy link

Still broken in v0.16.1

@orxelm
Copy link

orxelm commented Mar 2, 2021

same here with v0.16.1

@rokasaitenta
Copy link

Still broken in 0.16.1.

@mkondel
Copy link
Author

mkondel commented Mar 5, 2021

Folks. The image rotation is not handled equally by each browser. There are even differences between OS'es for the same browser. It is possible that even with a working JS lib (jimp or other) the EXIF data will get stripped/ignored by the upload. As an example, on windows chrome I have to pre-process all my images locally with a shell script that applies EXIF rotation directly to the files.

@nicolaric
Copy link

any updates?

@vishnutasok333
Copy link

still brocken in "jimp": "0.22.12"

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

No branches or pull requests