-
-
Save phoet/6c2cfbff0809af451109 to your computer and use it in GitHub Desktop.
Pillow PNG artifacts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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