Ask Your Question

Revision history [back]

How to fix "IOError: decoder jpeg not available"

I have stuck when I compile these code in SageNotebook:

from PIL import Image
img=Image.open("/home/pmath/Music/im1.jpg") 
img2=img.convert("L")
img2.save("/home/pmath/Music/secretimage.pgm")
img=Image.open("/home/pmath/Music/secretimage.pgm")
pix=img.load()
print pix

The following errors occur :

Traceback (click to the left of this block for traceback)
...
IOError: decoder jpeg not available

But when I compile these codes with python on the same OS(ubuntu32bit 16.04) it works well. The problems occur only on Sage. How can i fix this issue?

click to hide/show revision 2
retagged

How to fix "IOError: decoder jpeg not available"

I have stuck when I compile these code in SageNotebook:

from PIL import Image
img=Image.open("/home/pmath/Music/im1.jpg") 
img2=img.convert("L")
img2.save("/home/pmath/Music/secretimage.pgm")
img=Image.open("/home/pmath/Music/secretimage.pgm")
pix=img.load()
print pix

The following errors occur :

Traceback (click to the left of this block for traceback)
...
IOError: decoder jpeg not available

But when I compile these codes with python on the same OS(ubuntu32bit 16.04) it works well. The problems occur only on Sage. How can i fix this issue?