API Reference

models Module

processors Module

Imagekit image processors.

A processor accepts an image, does some stuff, and returns the result. Processors can do anything with the image you want, but their responsibilities should be limited to image manipulations–they should be completely decoupled from both the filesystem and the ORM.

class imagekit.processors.Adjust(color=1.0, brightness=1.0, contrast=1.0, sharpness=1.0)

Performs color, brightness, contrast, and sharpness enhancements on the image. See PIL.ImageEnhance for more imformation.

Parameters:
  • color – A number between 0 and 1 that specifies the saturation of the image. 0 corresponds to a completely desaturated image (black and white) and 1 to the original color. See PIL.ImageEnhance.Color
  • brightness – A number representing the brightness; 0 results in a completely black image whereas 1 corresponds to the brightness of the original. See PIL.ImageEnhance.Brightness
  • contrast – A number representing the contrast; 0 results in a completely gray image whereas 1 corresponds to the contrast of the original. See PIL.ImageEnhance.Contrast
  • sharpness – A number representing the sharpness; 0 results in a blurred image; 1 corresponds to the original sharpness; 2 results in a sharpened image. See PIL.ImageEnhance.Sharpness
class imagekit.processors.AutoConvert(format)

A processor that does some common-sense conversions based on the target format. This includes things like preserving transparency and quantizing. This processors is used automatically by ImageSpec and ProcessedImageField immediately before saving the image unless you specify autoconvert=False.

class imagekit.processors.ProcessorPipeline

A list of other processors. This class allows any object that knows how to deal with a single processor to deal with a list of them. For example:

processed_image = ProcessorPipeline([ProcessorA(), ProcessorB()]).process(image)
class imagekit.processors.Reflection

Creates an image with a reflection.

class imagekit.processors.Transpose(*args)

Rotates or flips the image.

Possible arguments:
  • Transpose.AUTO
  • Transpose.FLIP_HORIZONTAL
  • Transpose.FLIP_VERTICAL
  • Transpose.ROTATE_90
  • Transpose.ROTATE_180
  • Transpose.ROTATE_270

The order of the arguments dictates the order in which the Transposition steps are taken.

If Transpose.AUTO is present, all other arguments are ignored, and the processor will attempt to rotate the image according to the EXIF Orientation data.

class imagekit.processors.resize.Crop(width=None, height=None, anchor=None)

Resizes an image , cropping it to the specified width and height.

Parameters:
  • width – The target width, in pixels.
  • height – The target height, in pixels.
  • anchor

    Specifies which part of the image should be retained when cropping. Valid values are:

    • Crop.TOP_LEFT
    • Crop.TOP
    • Crop.TOP_RIGHT
    • Crop.LEFT
    • Crop.CENTER
    • Crop.RIGHT
    • Crop.BOTTOM_LEFT
    • Crop.BOTTOM
    • Crop.BOTTOM_RIGHT
class imagekit.processors.resize.Fit(width=None, height=None, upscale=None)

Resizes an image to fit within the specified dimensions.

Parameters:
  • width – The maximum width of the desired image.
  • height – The maximum height of the desired image.
  • upscale – A boolean value specifying whether the image should be enlarged if its dimensions are smaller than the target dimensions.

admin Module

class imagekit.admin.AdminThumbnail(image_field, template=None)

A convenience utility for adding thumbnails to Django’s admin change list.

Parameters:
  • image_field – The name of the ImageField or ImageSpec on the model to use for the thumbnail.
  • template – The template with which to render the thumbnail

Table Of Contents

Previous topic

Getting Started

Next topic

Changelog

This Page