Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I read an image file using Python? [closed]

Tags:

python

file

image

How do I read an image file and decode it using Python?

like image 461
Nimmy Avatar asked Sep 17 '10 13:09

Nimmy


People also ask

How do I read an image from a file in Python?

We use cv2. imread() function to read an image. The image should be placed in the current working directory or else we need to provide the absoluate path.


1 Answers

The word "read" is vague, but here is an example which reads a jpeg file using the Image class, and prints information about it.

from PIL import Image jpgfile = Image.open("picture.jpg")  print(jpgfile.bits, jpgfile.size, jpgfile.format) 
like image 88
TheGentleOne Avatar answered Oct 21 '22 02:10

TheGentleOne