Commit graph

24 commits

Author SHA1 Message Date
Eric Brelsford
7946fe54b5 processors in PILKit: module
Help those looking in the code find processors.
2013-04-10 14:24:02 -04:00
Matthew Tretter
da00e2a5da Moved Crop and Fit to resize module.
Crop doesn't necessarily imply the any scaling is taking place. Several
ideas were discussed, from renaming Crop to combining both processors
into a single Resize processor (as they were in the original IK), but
those solutions were felt to either precluded future extension
(alternative resize modes) or make the API too verbose.
2011-09-26 14:40:48 -04:00
Matthew Tretter
6adbef3475 Embracing duck typing.
ImageProcessor didn't do anything. I'd rather get it out of there to reduce the
temptation for future IK contributors to do type checking and mess up peoples'
custom processors.
2011-09-25 23:24:44 -04:00
Matthew Tretter
d6632c95f5 Documentation! 2011-09-25 21:04:11 -04:00
Eric Eldredge
f570bd0d7f Transpose processor now supports auto EXIF orientation.
Replaced calls to Image.open with an open_image utility function.
The open_image utility calls Image.open, but then wraps the opened Image's
copy method with a version that preserves EXIF data. This allows an
ImageSpec to copy the original image, yet still provide all the original
image's exif data to the processor pipeline.
2011-09-24 23:09:49 -04:00
Eric Eldredge
8a0bc084fe Processors no longer take a file argument.
They only get the image to process now.
2011-09-23 21:25:47 -04:00
Eric Eldredge
d99bf5327b Transpose processor has a new API.
Transpose now takes transposition constants as arguments. Multiple
transpositions can be sequenced together in one Transpose processor.
Auto transposition is not yet supported (PIL strips the EXIF data, so need to
find a workaround for getting that data to the processor).
2011-09-23 21:23:21 -04:00
Matthew Tretter
7e20b75ced Processors don't care about format.
The process of choosing an image format has been cleaned up and
Processors' role in determining the format has been removed.

Previously, processors would return a tuple containing the modified
image and the format. Other parts of IK overrode PIL's Image.format
with the target format, although that had no effect on PIL and the fact
that it didn't throw an error was just lucky.
2011-09-23 20:18:51 -04:00
Matthew Tretter
15e49be719 Extracted ProcessorPipeline
Pulled some functionality out of _ImageSpecMixin into the ProcessorPipeline
class so it could be used independently of the model-related stuff.
2011-09-23 19:12:04 -04:00
Matthew Tretter
0ef56e1aaa process() accepts file
In the old IK API, processors (like `Transpose`) were able to access
the file by inspecting the model instance (which carried an options
object that specified the attribute name of the ImageField from which
the file could be extracted). Since the new API allows for multiple
ImageFields (and because IKOptions have been removed), it became
necessary to provide more information. Initially, this was accomplished
by passing the spec to `process()`, however with the addition of
ProcessedImageField, it became clear the a cleaner solution was to pass
only the field file (ImageSpecFile or ProcessedImageFieldFile).

This keeps the ORM stuff (fields, etc.) out of the `ImageProcessor` API
but (because field files, not just regular files, are passed) the
average hacker can still have their processor make use of model
information by accessing the model through the file's `instance`
property.
2011-09-22 17:58:33 -04:00
Matthew Tretter
bd7eb7284b BoundImageSpec is now ImageSpecFile
In preparation for unifying the ImageSpecFile and
ProcessedImageFieldFile interfaces.
2011-09-22 09:20:37 -04:00
Matthew Tretter
4e23254e73 Crop processor accepts anchor argument. 2011-09-21 19:02:18 -04:00
Matthew Tretter
e4c4fe02b3 Separated Crop.process() and Fit.process()
They didn't have enough in common to warrant them being branches of the
same method.
2011-09-21 18:24:02 -04:00
Matthew Tretter
a71b3ca337 Removed Format processor
The Format processor was really a special case and didn't do any
processing at all. Instead, ImageSpec just knew to look for it and
responded accordingly. Therefore, it's been replaced with a `format`
property on ImageSpec. This warranted a deeper look at how the format
and extension were being deduced (when not explicitly provided); the
results are documented in-code, though the goal was "no surprises."
2011-09-20 21:34:00 -04:00
Matthew Tretter
4c78f2d24c _imgfield is now a property of ImageSpec
Moved _imgfield from ImageModel to ImageSpec. Theoretically, this will allow you
to have specs that use different image fields on the same model.
2011-09-10 00:24:37 -04:00
Matthew Tretter
a1f11facbe Processors now use static properties. 2011-09-08 16:49:44 -04:00
Matthew Tretter
e32ccb617d Resize split into Crop and Fit. 2011-09-08 10:28:54 -04:00
Matthew Tretter
cd3395b68f Processors are now instance-based. 2011-09-08 10:28:50 -04:00
Justin Driscoll
125c2c1470 Cleaned up trailing whitespace 2009-12-19 11:01:54 -05:00
Justin Driscoll
eb97ed1180 spec.name now respects the upload_to path and added additional error handling to Transpose:auto 2009-07-19 15:26:53 -04:00
Justin Driscoll
68b8d46a2f Added 'auto' method to Transpose processor 2009-07-19 15:04:43 -04:00
Justin Driscoll
70da53ba4d Added format processor to force a format/extension change 2009-06-04 11:47:16 -04:00
Justin Driscoll
47e087e3b4 Fixed handling of palleted images 2009-06-04 11:06:11 -04:00
Ariel Nunez
920bf47128 Added setup.py and relocated source dir 2009-02-02 15:46:41 -05:00
Renamed from src/imagekit/processors.py (Browse further)