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

Incorrect aspect ratio displayed for thumbnails #184

Closed
markgllin opened this issue Sep 16, 2020 · 8 comments
Closed

Incorrect aspect ratio displayed for thumbnails #184

markgllin opened this issue Sep 16, 2020 · 8 comments

Comments

@markgllin
Copy link

Describe the bug
I've been using the docker nightly build and have noticed recently that the incorrect aspect ratio is being used for thumbnails. I switched over from the latest docker build but noticed it had memory issues but aspect ratio was displayed correctly with that version.

Unfortunately, I don't have any particular reproduction steps, it just seems to happen with most of my pictures (although some are displayed correctly for some reason)

Photo/video (optional) that causes the bug
An example photo:
20171223_122352

Screenshots
However, the thumbnail is displayed with equal height and width
image

Environment (please complete the following information):

  • I'm currently running PiGallery on a Raspberry Pi 4, 64-bit enabled within docker
  • I've been able to repro on both Chrome and Firefox (unable to load on safari)

Used app version:

  • docker-nightly (specifically alpine)

Happy to provide any more details/logs I can. As far as I can tell, no errors appeared in the logs during thumbnail creation or indexing

@markgllin
Copy link
Author

looking through past issues, this looks like it's related to #172 and #19

@bpatrik
Copy link
Owner

bpatrik commented Sep 16, 2020

yes for some reason I could not figure out why these photos are rotated. I'll try to give an other look with your photo.

@bpatrik bpatrik added the bug label Sep 16, 2020
@LorenzBischof
Copy link
Contributor

This also happens for me on the nightly build. The same picture (thumbnail) is shown correctly in the album art though.

@bpatrik
Copy link
Owner

bpatrik commented Sep 28, 2020

Yes its a new issue. With 1.8.0 the error would occure once you zoom in. Could not find the source of it yet.

@LorenzBischof
Copy link
Contributor

I'm not sure what you mean with "rotated". I was able to fix this behavior by adding object-fit: cover to the img. This also seems to be relatively well supported: https://caniuse.com/object-fit.

@bpatrik
Copy link
Owner

bpatrik commented Oct 14, 2020

Thanks for the PR, but I'm not sure that it will fix the issue.

The issue is the following:

  • Some of the photos are rotated in the bitmap, but the exif data signals that rotation (more here). Since recently, browser can handle it and based on the exif data rotate it back.
  • Grid is rendered based on the information that the server can read from the photo. It can read the original (bitmap) width and height and the info in the exif (exif width+ height + orientation)
  • Some of the photos (seems to be related to Iphone) are correctly rotated in the bitmap, but exif data suggest that their orientation is still not correct. Others photos are not correctly rotated and exif data also suggest their orientation is not correct.

I tried to resolve this, bit on the server side I could not figure out in which case should I rotate the dimension(width and height) of the photo and in which case not. I found that taking the orientation data into account produces more valid results than the other way around.

This is the code in question:

public static loadPhotoMetadata(fullPath: string): Promise<PhotoMetadata> {

I think setting object-fit:cover will result in some cropping, isn't it?

@LorenzBischof
Copy link
Contributor

Sorry, I did not test in Chrome. Yes in Firefox it gets cropped a little, but is not distorted anymore.

@bpatrik
Copy link
Owner

bpatrik commented Mar 27, 2021

Lets keep the conversation in #212 as that has more interactions. Closing this as it a duplicate.

@bpatrik bpatrik closed this as completed Mar 27, 2021
@bpatrik bpatrik added this to the v1.8.5 milestone Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants