| @@ -0,0 +1,152 @@ | |||||
| config.json | |||||
| # Created by https://www.toptal.com/developers/gitignore/api/python,virtualenv | |||||
| # Edit at https://www.toptal.com/developers/gitignore?templates=python,virtualenv | |||||
| ### Python ### | |||||
| # Byte-compiled / optimized / DLL files | |||||
| __pycache__/ | |||||
| *.py[cod] | |||||
| *$py.class | |||||
| # C extensions | |||||
| *.so | |||||
| # Distribution / packaging | |||||
| .Python | |||||
| build/ | |||||
| develop-eggs/ | |||||
| dist/ | |||||
| downloads/ | |||||
| eggs/ | |||||
| .eggs/ | |||||
| lib/ | |||||
| lib64/ | |||||
| parts/ | |||||
| sdist/ | |||||
| var/ | |||||
| wheels/ | |||||
| pip-wheel-metadata/ | |||||
| share/python-wheels/ | |||||
| *.egg-info/ | |||||
| .installed.cfg | |||||
| *.egg | |||||
| MANIFEST | |||||
| # PyInstaller | |||||
| # Usually these files are written by a python script from a template | |||||
| # before PyInstaller builds the exe, so as to inject date/other infos into it. | |||||
| *.manifest | |||||
| *.spec | |||||
| # Installer logs | |||||
| pip-log.txt | |||||
| pip-delete-this-directory.txt | |||||
| # Unit test / coverage reports | |||||
| htmlcov/ | |||||
| .tox/ | |||||
| .nox/ | |||||
| .coverage | |||||
| .coverage.* | |||||
| .cache | |||||
| nosetests.xml | |||||
| coverage.xml | |||||
| *.cover | |||||
| *.py,cover | |||||
| .hypothesis/ | |||||
| .pytest_cache/ | |||||
| # Translations | |||||
| *.mo | |||||
| *.pot | |||||
| # Django stuff: | |||||
| *.log | |||||
| local_settings.py | |||||
| db.sqlite3 | |||||
| db.sqlite3-journal | |||||
| # Flask stuff: | |||||
| instance/ | |||||
| .webassets-cache | |||||
| # Scrapy stuff: | |||||
| .scrapy | |||||
| # Sphinx documentation | |||||
| docs/_build/ | |||||
| # PyBuilder | |||||
| target/ | |||||
| # Jupyter Notebook | |||||
| .ipynb_checkpoints | |||||
| # IPython | |||||
| profile_default/ | |||||
| ipython_config.py | |||||
| # pyenv | |||||
| .python-version | |||||
| # pipenv | |||||
| # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | |||||
| # However, in case of collaboration, if having platform-specific dependencies or dependencies | |||||
| # having no cross-platform support, pipenv may install dependencies that don't work, or not | |||||
| # install all needed dependencies. | |||||
| #Pipfile.lock | |||||
| # PEP 582; used by e.g. github.com/David-OConnor/pyflow | |||||
| __pypackages__/ | |||||
| # Celery stuff | |||||
| celerybeat-schedule | |||||
| celerybeat.pid | |||||
| # SageMath parsed files | |||||
| *.sage.py | |||||
| # Environments | |||||
| .env | |||||
| .venv | |||||
| env/ | |||||
| venv/ | |||||
| ENV/ | |||||
| env.bak/ | |||||
| venv.bak/ | |||||
| # Spyder project settings | |||||
| .spyderproject | |||||
| .spyproject | |||||
| # Rope project settings | |||||
| .ropeproject | |||||
| # mkdocs documentation | |||||
| /site | |||||
| # mypy | |||||
| .mypy_cache/ | |||||
| .dmypy.json | |||||
| dmypy.json | |||||
| # Pyre type checker | |||||
| .pyre/ | |||||
| # pytype static type analyzer | |||||
| .pytype/ | |||||
| ### VirtualEnv ### | |||||
| # Virtualenv | |||||
| # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ | |||||
| [Bb]in | |||||
| [Ii]nclude | |||||
| [Ll]ib | |||||
| [Ll]ib64 | |||||
| [Ll]ocal | |||||
| [Ss]cripts | |||||
| pyvenv.cfg | |||||
| pip-selfcheck.json | |||||
| # End of https://www.toptal.com/developers/gitignore/api/python,virtualenv | |||||
| @@ -0,0 +1,3 @@ | |||||
| { | |||||
| "python.pythonPath": "venv\\Scripts\\python.exe" | |||||
| } | |||||
| @@ -0,0 +1,39 @@ | |||||
| from PIL import Image, ImageDraw, ImageFont | |||||
| def sub(p1, p2): | |||||
| return (p1[0] - p2[0], p1[1] - p2[1]) | |||||
| def overlay(image_in, image_out): | |||||
| image = image_in.convert("RGBA") | |||||
| size = image.size | |||||
| center = (size[0]/2, size[1]/2) | |||||
| message = "YOU DIED" | |||||
| font_size = size[1] // 6 | |||||
| gradient_range = size[1] // 10 | |||||
| rect_top = sub(center, (0, font_size * 3 // 4)) | |||||
| rect_bot = sub(center, (0, -font_size * 3 // 4)) | |||||
| overlay = Image.new("RGBA", size, (0,0,0,0)) | |||||
| draw = ImageDraw.Draw(overlay) | |||||
| font = ImageFont.truetype("OptimusPrinceps.ttf", font_size) | |||||
| draw.rectangle([0, rect_top[1], size[0], rect_bot[1]], fill=(0,0,0)) | |||||
| for y in range(-1, -gradient_range - 1, -1): | |||||
| c = 255 - 255 * (-y) // gradient_range | |||||
| draw.line([0, rect_top[1] + y, size[0], rect_top[1] + y], fill=(0,0,0,c)) | |||||
| for y in range(1, gradient_range + 1, 1): | |||||
| c = 255 - 255 * (y) // gradient_range | |||||
| draw.line([0, rect_bot[1] + y, size[0], rect_bot[1] + y], fill=(0,0,0,c)) | |||||
| text_size = draw.textsize(message, font=font) | |||||
| offset = (center[0] - text_size[0]/2, center[1] - text_size[1]/2) | |||||
| draw.text(offset, message, (255,0,0), font=font) | |||||
| result = Image.alpha_composite(Image.alpha_composite(image, Image.new("RGBA", size, (0,0,0,100))), overlay) | |||||
| return result | |||||