To read an image directly from url and then reads its size. you can use urllib.request and PIL aka Pillow.
If you don’t have pillow installed. you can use:
python -m pip install Pillow
and before that you might need to upgrade pip, especially if you get an error
python -m pip install --upgrade pip
Here is how to read an image from url.
import urllib.request from PIL import Image url = 'http://www.example.com/my_image_is_not_your_image.png' image = Image.open(urllib.request.urlopen(url)) width, height = image.size print (width,height)
If you followed a tutorial that uses urllib2 you can change that to urllib.request in python 3.
This is probably the worst display of source code I’ve ever seen in my life.
Agreed.
cannot agree more
Agree, but whatever, it helped me out.
wtf is this dispay
thanks for this. although whoever’s responsible for this source code display needs to address the hatred in their heart.