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

Vertical photos are rotated #9

Closed
atasinti opened this issue Nov 25, 2023 · 21 comments
Closed

Vertical photos are rotated #9

atasinti opened this issue Nov 25, 2023 · 21 comments
Assignees
Labels
bug Something isn't working

Comments

@atasinti
Copy link

Describe the bug
When I upload a vertically long photo, it gets rotated.

original image
IMG_20231125_120909

URL after upload
https://nostrcheck.me/media/public/c4722b34509de39194f3662a62735ee0ff699a41fdc2f22f4f965498b71ff5ea.webp

@quentintaranpino quentintaranpino self-assigned this Nov 25, 2023
@quentintaranpino quentintaranpino added the bug Something isn't working label Nov 25, 2023
@quentintaranpino
Copy link
Owner

Hello @atasinti I cannot reproduce it. Could you tell me from which client you are uploading it?

@atasinti
Copy link
Author

I used a client called Nostter ( https://nostter.app/ ) to upload images.
I heard from Nostter developer @SnowCait that the issue was reproduced by uploading directly without using Nostter.
Does this occur when the photo data includes rotation?

@SnowCait
Copy link
Contributor

SnowCait commented Feb 19, 2024

FYI
https://zpl.fi/exif-orientation-in-different-formats/

I think exif orientation information is ignored when converting jpg to webp, but I'm not sure. (ffmpeg issue?)

@quentintaranpino
Copy link
Owner

Hi, I have been testing. Uploading the image from nostter and from coracle. It always comes out vertically.

Can you give me more information? I'm sorry but I can't replicate it. @atasinti @SnowCait

@quentintaranpino
Copy link
Owner

To test, edit the image a bit so that the hash is not the same. Otherwise the server will always return the same image.

@SnowCait
Copy link
Contributor

My reproduction steps (Windows 10 + Chrome)

  1. Go to https://zpl.fi/exif-orientation-in-different-formats/
  2. Download right image of JPEG
  3. Upload the image to nostrcheck.me through "Upload file" button in my page
  4. See it and it is like this

image

Original image in step 2. is:
image

@SnowCait
Copy link
Contributor

My browser doesn't support orientation of WebP.
image

@quentintaranpino
Copy link
Owner

I think it is already solved 🥳🥳🥳

https://nostrcheck.me/media/quentin/4a8208b26f345648e98a1258f4b46ce57549ad5c6d52a22a8020a24b739e2c40.webp

It was the version of ffmpeg in debian in production. I have always been testing it on my development machine which had a higher version of ffmpeg 😅

Can you validate it? Thank you very much for notifying me of the error 🙏

@SnowCait
Copy link
Contributor

SnowCait commented Feb 23, 2024

Orientation is solved! 🎉🎉🎉

However, aspect ratio seems to be strange.
I tested it using: (original)
https://blog.knjcode.com/wp-content/uploads/2014/02/right.jpg
Uploaded images is: (nostrcheck.me)
https://nostrcheck.me/media/snowcait/e1086e9da632245eb27007e0ddca964b1ecbd3761632be1a0576ed10adf6dc95.webp

@quentintaranpino
Copy link
Owner

image

ffprobe is detecting the dimensions (only of this file) backwards!!!

I'm going to have a coffee and check it out, right now I don't know if it's me or if it's really happening 😂😂

@quentintaranpino
Copy link
Owner

I just uploaded it to this site, and it also detects the width and height in reverse.

https://www.metadata2go.com/result#j=1aa5351f-04bb-4654-8896-4ebab2bfaadd

Weird... I check it!

@SnowCait
Copy link
Contributor

Original image is broken...? I'm sorry.

I test another image and it works well.
original:
https://github.com/recurser/exif-orientation-examples/blob/master/Landscape_3.jpg
nostrcheck.me:
https://nostrcheck.me/media/snowcait/b151bf11b88398f7358a3a74bf8b7f96b9e436f3d4bb2f86034d1c412039d2d3.webp

@quentintaranpino
Copy link
Owner

Maybe, but how strange! 🤔🤔 I'm going to check it out anyway. If it's ok with both of you, I'll close this issue!! @atasinti @SnowCait 🥳🥳🥳🥳

@SnowCait
Copy link
Contributor

Thank you so much!

@atasinti
Copy link
Author

I've confirmed.
Vertically long photos no longer rotate.
However, the photo will be transformed into a horizontally long photo.

original photo
IMG_20240221_122913

URL after upload
https://nostrcheck.me/media/public/0dffefd838d47e7b4ed0979db563a74bb3c92d711e4e6fa38349bde36b9cc51d.webp

@quentintaranpino
Copy link
Owner

Can you send me the original image?

I just uploaded the example you indicated and it displays fine.

https://nostrcheck.me/media/public/9da6b7c01a19dacc2519aaf019451ff377fc72af1642849aa0006b2ff6eb2779.webp

@atasinti
Copy link
Author

I will attach the original image compressed with zip.
Please unzip and check.
IMG_20240221_122913.zip

@quentintaranpino
Copy link
Owner

Hi, I have been testing.

The server detects the width and height upside down, so I checked it with an online service and it also detected the measurements upside down as well.

image

It should be:

width: 3000
height: 4000

https://www.metadata2go.com/result#j=21666df0-b809-48c0-8122-043467fb5435

image

As you can see, this service also detects the measurement in reverse. I am thinking about not using the metadata for the measurements anymore and calculate them myself in real time, which may eventually make the process a bit slower.

I'm going to investigate for my part, can you think what could be happening?

@quentintaranpino
Copy link
Owner

I think I have it, the problem is the orientation.

I have done some research and sharp allows me to get it.

image

I will check that everything is ok (especially with videos and other images) and upload a patch.

@quentintaranpino
Copy link
Owner

It works!

https://nostrcheck.me/media/134743ca8ad0203b3657c20a6869e64f160ce48ae6388dc1f5ca67f346019ee7/0dffefd838d47e7b4ed0979db563a74bb3c92d711e4e6fa38349bde36b9cc51d.webp

I have deleted 2 entries in the database with this hash so that the server can reprocess it.

If you already uploaded it with your username you can upload it again and the same URL will be generated.

On the other hand, clear your browser cache to see the change, I cleared the cloudflare cache for this particular file.

As soon as you can, confirm me that everything is OK and I will be able to close (finally) the issue 😀

@atasinti
Copy link
Author

atasinti commented Mar 5, 2024

I have confirmed that the issue is resolved.
Thank you for your early action!

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
None yet
Development

No branches or pull requests

3 participants