Python: How to find dimensions of the image?

0 votes
How to find out the dimensions of the image and convert it into a two-dimensional array?
Jul 11 in Python by Kunal
22 views

1 answer to this question.

0 votes

You can use the Pillow package here, which is the successor of PIL.

from PIL import Image  # uses pillow 
image_file = "something.jpg"
im = Image.open(image_file)
print im.size # return value is a tuple, ex.: (1200, 800)
answered Jul 11 by Likith

Related Questions In Python

–1 vote
2 answers

How to find the size of a string in Python?

following way to find length of string  x ...READ MORE

answered Mar 29 in Python by rajesh
• 1,210 points
81 views
0 votes
1 answer
0 votes
1 answer

How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,720 points
74 views
0 votes
1 answer

How to get the size of a string in Python?

If you are talking about the length ...READ MORE

answered Jun 4, 2018 in Python by ariaholic
• 7,340 points
87 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 224 views
+4 votes
6 answers
0 votes
1 answer

How to find the type of variable in Python?

i=277 type(i) # int i = 2.56j type(i) # complex i ...READ MORE

answered Jul 16 in Python by Arvind
• 2,960 points
15 views
0 votes
1 answer