Is there a way to resize images of any shape or size to say [500x500] , but keep the aspect ratio of the image so that the empty space is filled with white / black filler?
So say that the image [2000x1000] , after it has changed to [500x500] , the actual image will be [500x250] , with 125 either side being white / black filler.
Something like that:
Enter

Exit

EDIT
I donโt want to just display the image in a square window, instead of changing the image to this state and then saving it to a file, creating a collection of images of the same size with minimal image distortion.
The only thing I came across when asking a similar question was this post , but its in php .
c ++ image opencv image-resizing
MLMLTL
source share