My system: Mac OS X 10.7
Python 2.7.1
NumPy version 1.5.1
My code:
image = openImage(fileDir)
print image
image = np.asarray(image)
print image
If I run this:
python main.py 1010.png
the output is:
<PIL.PngImagePlugin.PngImageFile image mode=RGB size=10x10 at 0x10A835368>
[[[226 226 226] ... `
If I run this:
python main.py google.jpg
the output is:
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=488x640 at 0x10140B368>
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=488x640 at 0x10140B368>
I cannot figure out why numpy
can converts png's but can't do it on jpg's, why? How can I solve this?
edit:
ok tried with
image.show()
and got following error-message:
IOError: decoder jpeg not available
i solved the problem with the information i got from this page:
http://mariz.org/blog/2007/01/26/mac-os-x-decoder-jpeg-not-available/
i solved the problem with the information i got from this page:
http://mariz.org/blog/2007/01/26/mac-os-x-decoder-jpeg-not-available/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With