File: imagegenerators.py

package info (click to toggle)
python-django-imagekit 4.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 696 kB
  • sloc: python: 2,000; makefile: 133
file content (16 lines) | stat: -rw-r--r-- 449 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from imagekit import ImageSpec, register
from imagekit.processors import ResizeToFill


class TestSpec(ImageSpec):
    pass


class ResizeTo1PixelSquare(ImageSpec):
    def __init__(self, width=None, height=None, anchor=None, crop=None, **kwargs):
        self.processors = [ResizeToFill(1, 1)]
        super(ResizeTo1PixelSquare, self).__init__(**kwargs)


register.generator('testspec', TestSpec)
register.generator('1pxsq', ResizeTo1PixelSquare)