Hello,
I want to convert the input 24 bit PNG image to 8 bit, I have tried using Imagemagick and Python PIL, neither works.
for instance:
at Imagemagick I try convert console command as such:
convert -depth 8 png24image.png png8image.png
And here is the way I tried with python:
import Image
def convert_8bit(src, dest):
"""
convert_8bit: String, String -> void.
Converts the input image file into 8bit depth.
"""
im = Image.open(src)
if not im.mode == "P":
im2 = im.convert("P", rgb2xyz)
im2.save(dest)
Imagemagick doesn't even touch the image while the python function reduces to 8bit but keeps the number of unique numbers 164instead of 256. Photoshop used to convert the image to 8bit with 256unique numbers when converted to png8 from a 24 bit png image.
Thanks
EDIT:
Output of 24->8 png conversion via Photoshop (which I need)
Converted via my Python function