pythonでPILを使用して画像を表示させようとしていますが、できません。
プログラムと画像は両方デスクトップに置いてあり
macのターミナルから実行しています。
以下ソースです.
python
1from PIL import Image 2im = Image.open("imgres.jpg") 3im.show()
実行しようとすると
Traceback (most recent call last):
File "image.py", line 3, in <module>
img = Image.open('imgres.jpg')
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 1952, in open
fp = builtin.open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'imgres.jpg'
oks:Desktop ok$ python image.py
Traceback (most recent call last):
File "image.py", line 3, in <module>
im.show()
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 1483, in show
_show(self, title=title, command=command)
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 2123, in _show
apply(_showxv, (image,), options)
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 2127, in _showxv
apply(ImageShow.show, (image, title), options)
File "/Library/Python/2.7/site-packages/PIL/ImageShow.py", line 41, in show
if viewer.show(image, title=title, **options):
File "/Library/Python/2.7/site-packages/PIL/ImageShow.py", line 66, in show
self.show_image(image, **options)
File "/Library/Python/2.7/site-packages/PIL/ImageShow.py", line 85, in show_image
return self.show_file(self.save_image(image), **options)
File "/Library/Python/2.7/site-packages/PIL/ImageShow.py", line 81, in save_image
return image._dump(format=self.get_format(image))
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 488, in _dump
self.load()
File "/Library/Python/2.7/site-packages/PIL/ImageFile.py", line 189, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 385, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
と、なります。
どうすれば表示できますか?

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/11/10 15:01
2016/11/10 15:05
2016/11/10 15:06
2016/11/10 15:10
2016/11/10 15:12
2016/11/10 15:17
2016/11/10 15:18
2016/11/10 15:28