Created
August 3, 2017 01:56
-
-
Save augustogoulart/cf29881beba904990716c1fc0756a7c4 to your computer and use it in GitHub Desktop.
Simple profiler to understand Pillow memory usage working with images in memory.
This file contains hidden or 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
from urllib.request import urlopen | |
from PIL import Image | |
from memory_profiler import profile | |
@profile | |
def run(): | |
img = Image.open(urlopen("https://graviolastatics.s3.amazonaws.com/thumbnails/card.jpg")) | |
thumbnail = img.resize((300, 300), Image.ANTIALIAS) | |
thumbnail.show() | |
if __name__ == "__main__": | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment