I have some images which have different sizes.
I would like to do the following:

1. Read in the image.
2. Square the image by adding black pixels in such a way that the image with the black pixels takes as height and width the bigger value of the both and the original image is in the center and the pixels are equally distributed below or upon (on the left/ right) the image.
3. Resize the image to 224, 224.

So, graphically the process I would like to code looks as follows:

[![Image process](https://i.stack.imgur.com/7xcJ7.png)](https://i.stack.imgur.com/7xcJ7.png)

I coded the steps 1 and 3, but regarding step 2 I am stumbling:

```
file_name = "/path/to/image.png"
img = imread(file_name)
#Squaring, adding black pixel, center the image

img = resize(img, (224, 224))

```