Skip to content

Instantly share code, notes, and snippets.

@frankwiles
Created August 17, 2011 20:53
Show Gist options
  • Save frankwiles/1152592 to your computer and use it in GitHub Desktop.
Save frankwiles/1152592 to your computer and use it in GitHub Desktop.
Imagekit use
# In imagekit_specs.py
from imagekit.specs import ImageSpec
from imagekit import processors
class EnhanceAvatar(processors.Adjustment):
contrast = 1.2
sharpness = 1.1
class ResizeAvatar(processors.Resize):
width = 100
height = 100
crop = True
class Avatar(ImageSpec):
access_as = 'avatar'
pre_cache = True
quality = 100
processors = [ResizeAvatar, EnhanceAvatar]
# In models
class Member(ImageModel):
picture = models.ImageField()
class IKOptions:
spec_module = 'imagekit_specs'
image_field = 'picture'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment