Adjustments

Daguerre provides a variety of adjustments to use when processing images, as well as an API for registering custom adjustments.

Built-In Adjustments

When used with the template tag, these adjustments should be referred to by their lowercase name:

{% adjust image "fit" width=300 %}

See Template Tags for examples.

Custom Adjustments

You can easily add custom adjustments for your particular project. For example, an adjustment to make an image grayscale might look something like this:

# Somewhere that will be imported.
from daguerre.adjustments import Adjustment, registry
from PIL import ImageOps

@registry.register
class GrayScale(Adjustment):
    def adjust(self, image, areas=None):
        return ImageOps.grayscale(image)
    adjust.uses_areas = False

Now you can use your adjustment in templates:

{% adjust image "grayscale" %}