Reputation: 199
I'm facing an strange problem with PIL. Whenever I am compiling the following code with python everything is ok:
from PIL import Image
file=Image.open("si.jpg")
file2=file.convert("L")
pix = file2.load()
print pix
colsize,rowsize=file2.size
for i in range(rowsize):
for j in range(colsize):
if pix[j,i]>250:
pix[j,i]=250
file2.save("ci2.pgm")
But when I compile the above code in SageMath Notebook, it gives an error “IOError: decoder jpeg not available”. Here is the scrrenshot :
I have found a similar problem here, but these solution does not work for me. My OS is Ubuntu 16.04 (32bit).
The image link :
)
I want to get solution for SageMath. How do I solve this issue?
Upvotes: 1
Views: 487
Reputation: 3453
It seems your version of the Python package "Pillow" (the Python Image Library) is missing the decoder for jpg.
To install it, quit Sage, and in a terminal, run the following:
$ sudo apt-get install libjpeg-dev
$ sage --pip install --no-cache-dir -I pillow
Then restart Sage and try running your code again.
Upvotes: 1