Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#425 closed enhancement (wontfix)

django.utils.images should have a thumbnail function

Reported by: espen@… Owned by: Adrian Holovaty
Component: Tools Version:
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


i just taught that django.utils.images should have a function that could create a thumbnail.

Change History (5)

comment:1 Changed 13 years ago by Adrian Holovaty

Can somebody write a patch? Just add a function get_thumbnail (which would return the raw bytes of the thumbnail, right?) in django/utils/

comment:2 Changed 13 years ago by Esaj

It would be nice if thumbnails were created when the image file is initially uploaded. Is there an elegant way to do this? Creating several different sized thumbnails per original image would be useful too.

comment:3 Changed 13 years ago by hugo <gb@…>

Feel free to steal the code from the image helper in my "stuff" project. There are two functions interesting in this context: cropImage will crop out the largest part of an image that will fit in the bounding box while scaleImage will scale the image so that it will fit into the bounding box while keeping it's aspect ratio. Both functions take the bounding box and a PIL image as input and return a PIL image as output.

comment:4 Changed 13 years ago by hugo <gb@…>

Oh yes, sorry: to get the image as a stream of bytes, just do a on a StringIO object. To read your original file just do a on your file.

comment:5 Changed 13 years ago by Adrian Holovaty

Resolution: wontfix
Status: newclosed

Marking this as a wontfix, cause there are many more other things to do and this is a bit out of the scope of Django.

Note: See TracTickets for help on using tickets.
Back to Top