Skip to content

Instantly share code, notes, and snippets.

@atul-bhouraskar
atul-bhouraskar / simple_thumbnail.py
Created November 29, 2012 03:13
Django function to populate a thumbnail image field from another image field
from PIL import Image as PILImage
import os
from django.core.files import File
from django.core.files.base import ContentFile
from cStringIO import StringIO
def create_thumbnail_from_image_field(image_field, thumbnail_image_field,
thumb_width, thumb_height):
"""
This function is intended to be used with a model similar to