OpenShot / openshot-qt

OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality video editing and animation solutions to the world.
http://www.openshot.org
Other
4.34k stars 541 forks source link

Best Fit doesn't fit neither vertically nor horizontally for rotated pictures #5605

Open Lagomorpheux opened 2 months ago

Lagomorpheux commented 2 months ago

Describe the bug: Best Fit not fitting neither vertically nor horizontally for rotated pictures.

Steps to reproduce the behavior:

  1. Open openshot-qt.
  2. Use default [HD 720p 30 fps] profile for video preview.
  3. Import a 1080x1920 vertical image. Here's the one used in the screenshots: VerticalHorizontalSample
  4. Add the imported image to track 1. Scale is set to Best Fit by default. Screenshot from 2024-08-28 15-03-17
  5. Right click on the image in the track and go to Rotate > Rotate 90 (Left). Scale is still set to Best Fit, but the preview isn't fitting the image neither horizontally nor vertically. Screenshot from 2024-08-28 15-04-39
  6. Interestingly, if scale is set to stretch, it stretches vertically, but not horizontally. Screenshot from 2024-08-28 15-05-17

Expected behavior: Rotating the image 90 degrees and keeping scale to Best Fit should fit the rotated image both vertically and horizontally to the edges of the preview.

System Details:

INFO app: ------------------------------------------------
INFO app:             OpenShot (version 3.2.1)            
INFO app: ------------------------------------------------
INFO app: openshot-qt version: 3.2.1
INFO app: libopenshot version: 0.3.3
INFO app: platform: Linux-6.5.0-44-generic-x86_64-with-glibc2.4
INFO app: processor: x86_64
INFO app: machine: x86_64
INFO app: python version: 3.8.10
INFO app: qt5 version: 5.12.8
INFO app: pyqt5 version: 5.14.1
INFO app: Frozen version info from build server:
{
    "build_name": "OpenShot-v3.2.1-release-candidate-12654-044bb224-23713d3a",
    "date": "2024-07-10 21:02",
    "libopenshot": {
        "CI_COMMIT_REF_NAME": "develop",
        "CI_COMMIT_SHA": "044bb2243ffb4230dea4c30429e86fee963ec1b1",
        "CI_JOB_ID": "38885",
        "CI_PIPELINE_ID": "12542",
        "CI_PROJECT_NAME": "libopenshot",
        "SO": "26",
        "VERSION": "0.3.3"
    },
    "libopenshot-audio": {
        "CI_COMMIT_REF_NAME": "develop",
        "CI_COMMIT_SHA": "23713d3a767cba1568729bc760b66f912ba710f4",
        "CI_JOB_ID": "38867",
        "CI_PIPELINE_ID": "12535",
        "CI_PROJECT_NAME": "libopenshot-audio",
        "SO": "9",
        "VERSION": "0.3.3"
    },
    "openshot-qt": {
        "CI_COMMIT_REF_NAME": "release-20240709",
        "CI_COMMIT_SHA": "637beec94d467ad6cde32d52647fbb271aabf199",
        "CI_JOB_ID": "39196",
        "CI_PIPELINE_ID": "12654",
        "CI_PROJECT_NAME": "openshot-qt",
        "SO": null,
        "VERSION": "3.2.1"
    }
}
Lagomorpheux commented 2 months ago

Conjecture: is it possible that openshot is scaling to Best Fit first and then rotating 90 degrees second, always in that order? Best Fit in the rotated picture has exactly the same size in the preview as the original. Strech stretches only vertically for a similar reason. In the original picture, it would be allowed to stretch horizontally, but not vertically. The rotated picture then stretches vertically, but not horizontally. For these reasons, it seems to me that the bug lies in the order those two actions are executed.

Also, I didn't mention this in the bug report, but the obvious workaround is rotating the picture outside of openshot.

Colorjet3 commented 2 months ago

Hello @jonoomph This needs your input.