Login

Tag "background"

Snippet List

sorl.thumbnail processor: white background

If you want to resize transparent PNGs with the `{% thumbnail %}` templatetag, they'll sometimes get an ugly black background that looks even more ugly on a white background. This processor puts the image on a white background. You can simply change the background color by replacing `white` with any other color. To use this filter simple put the following two lines of code in your settings file: from sorl.thumbnail.defaults import PROCESSORS as THUMBNAIL_PROCESSORS THUMBNAIL_PROCESSORS = ('path.to.white_background',) + THUMBNAIL_PROCESSORS

  • png
  • background
  • sorl.thumbnail
Read More

Image gradients on the fly

A Django view to create an image gradient on the fly as a PNG file. The direction, size and colors of the gradient a specified in the filename and extracted by Django in the urls.py. Example usage from CSS: `background: url(/gradient-down-255,255,255-to-0,0,0-70-of-120.png) repeat-x;` creates a 70-pixel vertical gradient as background from white to gray. No static images needed. To modify, nothing but the CSS needs to be edited.

  • image
  • gradient
  • background
Read More

2 snippets posted so far.