mlt icon indicating copy to clipboard operation
mlt copied to clipboard

Discovered a bug regarding image size scaling and rotation

Open w-wj-07 opened this issue 5 months ago • 0 comments

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

w-wj-07 avatar Jan 19 '24 04:01 w-wj-07