How to crop a photo?

There is a photo. You need to trim from each side by 5%. I found the crop function, but do not fully understand how it works: how to ask (and where to get) the original dimensions of the photo by OpenCV?
July 2nd 19 at 17:46
1 answer
July 2nd 19 at 17:48
It is not necessary to shoot from a gun on sparrows.
from PIL import Image

img ="img.jpg")

w5 = (img.size[0] // 100) * 5
h5 = (img.size[1] // 100) * 5

croped = img.crop(
 img.size[0] - w5,
 img.size[1] - h5

Or even easier for square images
from PIL import Image
from PIL import ImageOps

img ="img.jpg")
w5 = (img.size[0] // 100) * 5

croped = ImageOps.crop(img, w5)"croped.jpg")

Find more questions by tags OpenCVPython