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

Internal server error due to JPEG tran upscaling error on rotated images #53

Open
jrdh opened this issue Jul 23, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@jrdh
Copy link
Member

jrdh commented Jul 23, 2024

In #51 we started rotating images. Turns out in some (maybe all?) cases this breaks our image processing pipeline because the post-rotation image now has different width and height attributes compared to the data stored in the MSS index. This causes a problem because when we produce an images info.json file we use the width/height data from the MSS index if it exists to avoid having to load the original just to find out the size of it.

An example, https://data.nhm.ac.uk/media/0268bf86-0aca-4d10-af64-07887f4dc6ef produces an internal server error like this:

image

The original image (and all derivatives) have an EXIF orientation tag value of RightTop (which incidentally is wrong, the images actually don't need an EXIF orientation value, they're already the right way round, but that is a different problem...) and so after acquiring the source image and performing the rotation we end up with a portrait image, for example the source thumbnail file is 60x90. However, if we look at the MSS entry for this file, we find that EMu tells us it is 90x60. This results in the upscaling problem because when a user requests the a thumnail, for example, we use these MSS value to tell us the image size.

We can't completely switch to just using the actual source image size because users can also request different sizes etc using IIIF, so we need to either stop using the MSS values completely and always fetch the source image to get its real size (slow!) or we need to find a way to make the values in the MSS index match the reality. This may be possible because we do get EXIF information in EMu exports, so we might be able to just perform the rotation on index. This needs to be investigated further though to make sure it works as expected.

@jrdh jrdh added the bug Something isn't working label Jul 23, 2024
@jrdh jrdh self-assigned this Jul 23, 2024
@jrdh
Copy link
Member Author

jrdh commented Jul 23, 2024

That test image I used above has the EXIF orientation value of ExiValue:35=Rotate 90 CW in an EMu export I found it in (emultimedia.export.20220728.gz). So at least for this one, we could read that and rotate. Why it has the non-standard value "Rotate 90 CW" is anyone's guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant