Library with image processing capabilities.
pip install --user Pillow
from PIL import Image with Image.open(filepath) as img: width, height = img.size