The problem is not related to the related question, instead you should fix the PIL so that it reads the tRNSPNG fragment correctly . PIL takes one value for this fragment, but this image depicts a transparency description for each value in the palette. After that, the problem is processed: convert the image to mode 'LA'and resize:
import sys
from PIL import Image
img = Image.open(sys.argv[1])
pal = img.getpalette()
width, height = img.size
actual_transp = img.info['actual_transparency']
result = Image.new('LA', img.size)
im = img.load()
res = result.load()
for x in range(width):
for y in range(height):
t = actual_transp[im[x, y]]
color = pal[im[x, y]]
res[x, y] = (color, t)
result.resize((64, 64), Image.ANTIALIAS).save(sys.argv[2])
So, move on from this
to this:
PIL . PIL/PngImagePlugin.py, chunk_tRNS, if, im_mode == "P" i >= 0, self.im_info["actual_transparency"] = map(ord, s).