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

Discovered a bug regarding image size scaling and rotation #970

Open
w-wj-07 opened this issue Jan 19, 2024 · 0 comments
Open

Discovered a bug regarding image size scaling and rotation #970

w-wj-07 opened this issue Jan 19, 2024 · 0 comments

Comments

@w-wj-07
Copy link

w-wj-07 commented Jan 19, 2024

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant