-
Notifications
You must be signed in to change notification settings - Fork 9
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
unable to rotate image? #12
Comments
I added before line 684 in flippy.nim the following code to debug it: echo $result & " -- " , 1+int((result.width - newWidth)/2) , " " , 1+int((result.height - newHeight)/2) , " " , newWidth , "/" , newHeight I found that the problem is indeed with out of bounds numbers and the result is var image = newImage(500,50,4)
echo image.rotate(20) I get negative results Should this happen? |
There seems to be a bug with the rotate method. @benjif could you take a look? |
Oh I have figured it out. It was trimming the image incorrectly. I created a better trim function and will now use that. Also added a test case for your error. Thank you for reporting the bug! |
Please excuse my comment. IMHO the four edges of the rotated box should be calculated and crop the image accordingly. |
Yeah you are probably right. I did not think about this case.
…On Fri, Apr 10, 2020, 7:38 AM Panayotis ***@***.***> wrote:
Please excuse my comment.
I think the trim function is wrong.
It is good as a generic method, but not in this case.
What if an image is mostly "transparent", but only the center is painted?
Then rotation will minimize the image instead, not just rotate it.
IMHO the four edges of the rotated box should be calculated and crop the
image accordingly.
Do you think we should discuss it more?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#12 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA6X7AMK6XZFG3PFZFVMLDRL4VNRANCNFSM4L7U7R3A>
.
|
Maybe take into account something like this Find the location of the four points
and keep the min/max X and min/max Y as bounding box of the clipped area |
Yes you are right. I will take a look. |
Hello!
I am trying to do a test rotation on an image.
I am using this code
but it fails with the following error message:
Am I using it wrong?
The text was updated successfully, but these errors were encountered: