-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save as indexed image #3
Comments
Hi there! You can save your image as either PNG or BMP by adding the appropriate extension to the image before saving it. |
Oh, I get what you are trying to say. Save it in "palette mode." I'll see what I can come up with. |
Hmm... I seem to be able to get it to work right with PNG and mostly right with GIF, but BMP eludes me |
GIF always gives a palette with 256 entries, I'm going to leave it at that |
It works with PNG, so that will be included in the next update |
If you find a way to do this for BMP in imageio, I'd be more than happy to implement it |
Also, some additional commentary
PNGs will now be saved as paletted, see v3.2.3 |
It looks like it’s not possible, at least not how I had it in mind. |
Yeah, the palette gets reordered. I think the root problem is that there's no way to take a 2D array of integers and save it as an indexed image directly. Right now I have to convert from indexed to RGB, then when I save it I can have the image "quantized", but since I've already done that it ends up with the correct palette. |
Pillow on the other hand has some methods that look interesting:
https://pillow.readthedocs.io/en/stable/reference/Image.html |
If Pillow is indeed capable of this functionality, perhaps an issue should be submitted to imageio to take advantage of it (seeing as it already relies on Pillow). |
Saving images as 8bit PNG/BMP with given palette would make sense
The text was updated successfully, but these errors were encountered: