Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Pillow PNG artifacts
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This script reproduces the issue with artifacts when
# handling (semi)transparent PNG files:
# https://github.com/python-pillow/Pillow/issues/1449
# Version used:
#
# Python 2.7.10 (default, Jul 14 2015, 19:46:27)
# [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
#
# PILLOW_VERSION: 3.0.0
#
#
# Setup:
# pip install pillow
#
from PIL import Image
from PIL import PILLOW_VERSION
def main():
im = Image.open("original.png")
# <PIL.PngImagePlugin.PngImageFile image mode=LA size=1820x672 at 0x10855F550>
im.thumbnail((259, 96))
im.save("thumbnail.png")
print "PILLOW_VERSION: ", PILLOW_VERSION
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment