Skip to content

Instantly share code, notes, and snippets.

View narrowfail's full-sized avatar
🏠
Working from home

Guillermo Colmenero narrowfail

🏠
Working from home
View GitHub Profile
import hashlib
from django.core.files.storage import FileSystemStorage
import os
def md5sum(file):
"""Calculate the md5 checksum of a file-like object without reading its
whole content in memory.
>>> from StringIO import StringIO
>>> md5sum(StringIO('file content to hash'))
@narrowfail
narrowfail / engine.py
Last active April 28, 2016 11:41
Sorl Thumbnail PILL Engine that accepts background color
"""
Sorl Thumbnail PILL Engine that accepts background color
---------------------------------------------------
Created on Sunday, February 2012 by Yuji Tomita
Modified on Monday 10, November 2014 by Guillermo Colmenero
"""
from PIL import Image, ImageColor
from sorl.thumbnail.engines.pil_engine import Engine