title: Resize image to maintain aspect ratio in Python, OpenCv
body: <p>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 &quot;fill&quot; the other dimension with the background color until it become 1000 x 1000 square. The original one must be in the center at the end.</p>