Skip to content

Instantly share code, notes, and snippets.

@bryanveloso
Created February 10, 2011 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanveloso/819905 to your computer and use it in GitHub Desktop.
Save bryanveloso/819905 to your computer and use it in GitHub Desktop.
An example of django-imagekit's specfile.
class Shot(ImageModel):
photo = models.ImageField(upload_to='photos/groups/')
taken = models.DateField()
class IKOptions:
image_field = 'photo'
spec_module = 'specs'
from imagekit.specs import ImageSpec
from imagekit import processors
class Enhance(processors.Adjustment):
contrast = 1.1
sharpness = 1.1
class ResizeDisplay(processors.Resize):
height = 296
class ResizeMini(processors.Resize):
crop = True
height = 30
width = 30
class ResizeThumb(processors.Resize):
width = 72
class ResizeRanking(processors.Resize):
width = 230
class Display(ImageSpec):
pre_cache = True
processors = [Enhance, ResizeDisplay]
quality = 80
class Mini(ImageSpec):
pre_cache = True
processors = [Enhance, ResizeMini]
quality = 80
class Ranking(ImageSpec):
pre_cache = True
processors = [Enhance, ResizeRanking]
quality = 80
class Thumbnail(ImageSpec):
pre_cache = True
processors = [Enhance, ResizeThumb]
quality = 80
@defunkt
Copy link

defunkt commented Oct 3, 2012

🆒 🔥 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment