ads/auto.txt

Resize Image Maintain Aspect Ratio Python

All About Image

Resize Image Maintain Aspect Ratio Python. I d like to get a 1000 x 1000 picture in python from any input picture so that the input doesn t lose it s aspect ratio. In other words i want to resize the input so that its longer dimension is 1000 pixels and fill the other dimension with the background color until it become 1000 x 1000 square.

Resize Images Torch Tensor Already Loaded On Gpu Keeping Their Aspect Ratio Vision Pytorch Forums
Resize Images Torch Tensor Already Loaded On Gpu Keeping Their Aspect Ratio Vision Pytorch Forums from discuss.pytorch.org

It sounds like you want to grab the original aspect ratio from the original image like so. Python script to resize an image while keeping the original aspect ratio. Also the aspect ratio of the original image could be preserved in the resized image.

In other words i want to resize the input so that its longer dimension is 1000 pixels and fill the other dimension with the background color until it become 1000 x 1000 square.

Without any distortion you have 2 options. Python script to resize an image while keeping the original aspect ratio. B add part of the image e g. Then you can resize the image correctly.