You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
376 B

4 months ago
import requests
# 获取图片的宽高
def getImgWidthHeight(img_url):
try:
url = f'{img_url}?x-oss-process=image/info'
response = requests.get(url)
jo = response.json()
width = int(jo['ImageWidth']['value'])
height = int(jo['ImageHeight']['value'])
return width, height
except:
return 182, 182