import Image image_path = '/game/pathon/24.jpg' img = Image.open(image_path) width,height = img.size print(width,height) 

Closed due to the fact that the issue is too general for the participants iluxa1810 , HamSter , aleksandr barakin , user194374, Denis Bubnov 25 Nov '16 at 21:14 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • If there is no module, try to install it - Vladimir Martyanov
  • If an error occurred while solving a (possibly large) task, then a specific question should be asked about the error (optionally mentioning the covering task) —add something like ModuleNotFoundError: No module named 'Image' in the header. If you ask about "how to import the Image module", then this question can be useful not only for people who want to get the "height and width of the image", but also for all those who have difficulty importing the Image module. - jfs
  • writes that No module named 'Image', I understand you need to download the library Pil - agre

1 answer 1

To import the Image module, you need to put the pillow package :

 $ pip install pillow 
  • Is it right in the code to register? - agre
  • @agre if you don’t know “what pip install and what the words “ put a python package ” mean then ask a separate Stack Overflow question (you can use the entire phrase inside “” in the form of a question header). - jfs