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

JPEG EXIF rotation tag is not considered #736

Open
Eiim opened this issue Jun 6, 2024 · 4 comments
Open

JPEG EXIF rotation tag is not considered #736

Eiim opened this issue Jun 6, 2024 · 4 comments

Comments

@Eiim
Copy link

Eiim commented Jun 6, 2024

JPEGs can be rotated through an EXIF orientation tag. This doesn't change the underlying image data, only how it should be interpreted. Unfortunately, Java's ImageIO library doesn't consider this tag, so images can be read with the incorrect rotation. For example, this image (intentionally not sheet music):

is read into Audiveris like so:
image

@hbitteur
Copy link
Contributor

hbitteur commented Jun 7, 2024

If the Audiveris engine has no way to detect this rotation by itself, what should we do?

  • The user could manually rotate the image via some external tool before submitting it to Audiveris. This is the current situation. It may require to extract the image, rotate it and insert it back into the containing book.
  • Or the user could explicitly ask Audiveris to directly rotate the sheet at hand by +90 or -90 degrees (feature not yet implemented).

In both cases, some user action is needed of course.

@Eiim
Copy link
Author

Eiim commented Jun 7, 2024

It should be possible to read the EXIF tags with ImageReader.getImageMetadata(). It appears that internally, the orientation is used here when reading dimension metadata, but I'm admittedly not sure what the right way to get that information is. I might play around with it later and see if I can find a solution.

@hbitteur
Copy link
Contributor

hbitteur commented Jun 7, 2024

In the code you mention, the "orient" variable is created from scratch and its value coded to "normal".
It is then inserted (or appended?) to the "dim" variable.

It does not seem to be read from the image data.
Perhaps in some other part of ImageIO code? ...

@hbitteur
Copy link
Contributor

hbitteur commented Jun 7, 2024

Perhaps the metadata-extractor library could help us?
But this maybe an overkill...

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

2 participants