title: Sepia images with Django, Python and Sorl-thumbnail link: http://jj.isgeek.net/2011/11/sepia-images-with-django-python-and-sorl-thumbnail/ author: Jj description: post_id: 809 date: 2011/11/27 02:26:20 created_gmt: 2011/11/27 07:26:20 comment_status: open slug: sepia-images-with-django-python-and-sorl-thumbnail ![Picture side by side of a toy in color and sepiia](/uploads/2011/11/bublebee-sepia.jpg) Meet [Sorl-sepia](https://github.com/jjdelc/sorl-sepia), a Sorl engine backend (PIL only so far) to turn your images into sepia tones. [See the README file for instructions](https://github.com/jjdelc/sorl-sepia/blob/master/README.md). The interesting trick about sepia images is that they are just gray-scale pictures with a different color palette. In this case the sepia color I'm using is #FFF0C0. Doing this on PIL is quite straight forward ([from effbot's blog](http://effbot.org/zone/pil-sepia.htm)): # You have your PIL Image instance on a 'im' variable # Convert it to grayscale im = im.convert('L') # L mode means gray-scale # Set the sepia palette im.putpalette(linear_ramp) # will explain this later # Make RGB again im = im.convert('RGB') And there you have it. Now the `linear_ramp` variable. It is actually a map of 256 blocks indicating what color to use for each of the possible gray-scale values (white to black). You can see the original blog post on [how to build the `linear_ramp`](http://effbot.org/zone/pil-sepia.htm). If you just want to turn your images to gray-scale instead of sepia, set [sorl-sepia](https://github.com/jjdelc/sorl-sepia) `SORL_DEFAULT_SEPIA_TONE` setting to (0, 0, 0).