I'm trying to create a color JPEG from Numeric data. I used Rob Hooft's message from earlier this year to get me started. All of his code appears to work fine. The problem appears when I try to save the image, i.e. img.save('filename.jpg'). I get the following error message: IOError: cannot write mode P as JPEG Can a PIL guru tell me what I'm doing wrong and how to proceed? I've attached the relevant python code to help. img = Image.Palette('P', (data.shape[1], data.shape[0]), data.tostring(), 'raw', 'P') img.palette = ImagePalette.raw('RGB', string.join(palette, '')) img.save('filename') -- Paul
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4