import:: doc:: from PIL import Image img = Image.open(io.BytesIO(req_img)) width, height = img.size # 获取宽高