Open abstractionmage opened 1 year ago
I think this is the intended behavior of the resize function of imutils, to maintain the original aspect ratio of the image while resizing. We can either suggest this as a feature or close the issue.
Even if this behavior is intended, right now this is just not obvious. I would at least add a docstring to the resize function, adding a note that the aspect ratio is maintained as well as a hint to the @param
description of the height argument stating that it is ignored if a width is given.
Maybe I can make a small PR for this later.
Though I would argue that if I as a user wanted the aspect ratio to be kept, I simply wouldn't specify a width and height that would break it. But if I wanted the aspect ratio to change, shouldn't I be able to use imutil's resize function as well rather than having to find one from a different library that allows me to do that?
So yeah, I would be in favor of a feature request. Maybe we could introduce a new optional argument to the resize function keep-aspect=True
to keep the feature backwards-compatible
Sounds good. Maybe I can work on it once the PR is done. Currently users have to switch between OpenCV and Imutils for different types of resizing. I liked the idea of using a parameter like "keep-aspect"
However I am not sure is the project is still active, the last commit seems to be made two years ago.
Steps to reproduce:
resized_image = imutils.resize(image, width=400, height=300)
Expected Behavior:
resized_image
should have a resolution of 400 by 300 pixelsActual Behavior:
resized_image
has a resolution of 400 by 255 pixels