I have a GIF image file. I opened it using PIL.Image
and did a couple of size transforms on it. Then I tried to use ImageSharpness.Enhance()
on it...
sharpener = PIL.ImageEnhance.Sharpness(img)
sharpened = sharpener.enhance(2.0)
This is causing an exception:
<type 'exceptions.ValueError'>
('cannot filter palette images',)
I tried to google for this error, but did not find anything. Can someone help me figure out what is going wrong?
FYI the mode of the input image is 'P'
. I don't have this problem if I work with jpg images.
sharpener = PIL.ImageEnhance.Sharpness (img.convert('RGB'))
It's quite common for algorithms to be unable to work with a palette based image. The convert
in the above changes it to have a full RGB value at each pixel location.
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