Image in numpy-array: jpg and png

My system: Mac OS X 10.7
Python 2.7.1
NumPy Version 1.5.1

My code is:

image = openImage(fileDir) print image image = np.asarray(image) print image 

If I run this:

 python main.py 1010.png 

conclusion:

 <PIL.PngImagePlugin.PngImageFile image mode=RGB size=10x10 at 0x10A835368> [[[226 226 226] ... ` 

If I run this:

 python main.py google.jpg 

conclusion:

 <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=488x640 at 0x10140B368> <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=488x640 at 0x10140B368> 

I can not understand why numpy can convert png, but can not do it in jpg, why? How can i solve this?

change

ok tried using

 image.show() 

and received the following error message:

 IOError: decoder jpeg not available 

I solved the problem with the information received from this page:
http://mariz.org/blog/2007/01/26/mac-os-x-decoder-jpeg-not-available/

+6
source share
1 answer

I solved the problem with the information received from this page:

http://mariz.org/blog/2007/01/26/mac-os-x-decoder-jpeg-not-available/

+1
source

Source: https://habr.com/ru/post/906512/


All Articles