Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Discovered a bug regarding image size scaling and rotation

Open
#970 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c

Research direction

Reproduce the example using the affine filter with distort and fill, then apply fix_rotate_x through the transition settings shown. Trace how transition.rect, non-proportional scaling, and rotation are handled, and compare the output at 90 and 45 degrees. Done means rotated output preserves the intended aspect ratio without distortion after non-proportional scaling.

Written by the indexing model from the issue text.

Description

Hello everyone, there is a strange bug here. When I non proportionally scale the original image size, for example, using the 'affine' filter to set the image size to 640x640, using both the 'distort' and 'fill' parameters, and then I use 'fix_rotate_x' to rotate the image 90 degrees , and you will find that the image has distortion, the aspect ratio of the rotated image has also changed,which is completely different from before the rotation I found that this problem also occurs when rotating at other angles.
However, I found that if I scale the original image proportionally, such as using the 'affine' filter's rect parameter to set the image size to 960x540 for a 1920x1080 resolution original image, and then rotate it 90 degrees, I did not find any abnormalities, and the image looked fine.
May I ask how to solve this problem? I want to achieve non proportional scaling of the image and then rotate it.

Here are some examples and detailed information

This is the original image
image

I scaled the original image in a non proportional manner to obtain this image
image

I rotated the scaled image 90 degrees clockwise and the resulting image is as follows. I can see that the aspect ratio of the image has changed, which is different from before the rotation
image

Similarly, when I rotate the scaled image clockwise by 45 degrees, the resulting image is as follows. It can be observed that the aspect ratio of the image has changed, which is different from before rotation, and there may also be distortion
image

However, when I proportionally scaled the original image and then rotated it, these issues did not occur
This is the original image
image

I scaled the original image in a proportional manner to obtain this image
image

I rotated the scaled image 90 degrees clockwise and the resulting image is as follows,this doesn't seem like a problem, the aspect ratio of the image before and after rotation is consistent
image

Similarly, when I rotate it 45 degrees, the image looks fine
image

This is how I use code:
filter->set("transition.distort", 1);
filter->set("transition.fill", 1);
char tmp[128];
snprintf(tmp, 128, "%g/%g:%gx%g:1", geometry.left(), geometry.top(), geometry.width(), geometry.height());
filter->set("transition.rect", tmp);
filter->set("transition.valign", "middle");
filter->set("transition.halign", "center");
filter->set("transition.fix_rotate_x", geometry.rotate());
producer->attach(*filter);

Dominant language
C
Stars
1.9k
Forks
391
Avg merge
1d 17h
Merged PRs (30d)
12

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mltframework/mlt

All issues in mltframework/mlt

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.