-
Notifications
You must be signed in to change notification settings - Fork 62
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
Implement an image scaling function. #98
Conversation
Thank you for this PR! ✨ I think this is worthy of a merge, my only question is if it might be better to just merge Afterall I think for most people the common sense thought would be that resizing the image also scales the content along with it. So having two functions do roughly the same but not quite seems a bit unnecessary to me. Additionally if you could provide some unit tests that would be great, if not I'll add them later myself. |
I myself had the problem of thinking resize would also scale the function when I first used it, so merging both seems a great idea to me! About the unit tests, I've never written proper ones, but I'll see what I can do. |
Alright, please merge them then I'll review the code :D Regarding tests that's alright, I need to do them anyway. Atm there's not enough of them. |
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it myself, works great!
The mlx_scale_image function first uses mlx_resize_image to create a copy of the given dimensions, then copies the raw pixel data of the original image into the new one, skipping or repeating pixels in order to make make the scaled image as faithful to the original as possible.
I've tried keeping readability and performance in mind, but some things could surely be improved.