Commit graph

187 commits

Author SHA1 Message Date
Matthew Tretter
1ffc8ca81e Remove duplicate resize.Crop
`resize.Crop` actually hasn't been moved to `crop.Crop` (as the removed
class claimed). In fact, what used to be called `resize.Crop` is now
`resize.Fill`. The confusion is understandable, since it's what
motivated the change in the first place!
2012-02-11 14:11:07 -05:00
Madis Väin
6dd0d2272f write the processors talked about in issue #93 2012-02-11 13:50:12 -05:00
Matthew Tretter
2467dfe912 Rename resize.Crop to resize.Fill 2012-02-11 13:36:30 -05:00
Matthew Tretter
c3ef5172c3 Rename ImageSpec to ImageSpecField
The ImageSpec class remains for now, but using it throws
deprecation warnings.
2012-02-11 13:06:48 -05:00
Matthew Tretter
c2a4d01b7c Only one return 2012-02-10 22:04:20 -05:00
Matthew Tretter
09b97ee62f Move SmartCrop to crop module
Addresses one of the issues raised by in @madisvain in #93
2012-02-10 19:42:36 -05:00
Jan Sagemueller
a041302c96 Resize processor: Add mat_color option to enforce the targeted image size 2012-02-08 09:25:37 -05:00
Timothée Peignier
eb801d75f5 small pep8 formatting fix 2012-01-27 13:45:22 +01:00
Matthew Tretter
343f14ad48 Use old-style string formatting 2012-01-26 18:19:39 -05:00
Timothée Peignier
3bac472561 ImageSpec accepts callable processors arg 2012-01-26 11:01:58 -05:00
Matthew Tretter
6333ee5d05 Makes Adjust transparency-compatible
And closes #64!
2012-01-03 18:57:32 -05:00
Bryan Veloso
3bacd51ba5 Bumping the version number. 2011-12-22 22:14:14 -08:00
Matthew Tretter
e574f1190f Merge pull request #73 from cyberdelia/fix-transpose-exif
Catch error when exif data doesn't exist
2011-12-07 21:37:48 -08:00
Matthew Tretter
dd28557323 Change handling of spec deletion
Though it's not the case with `FileSystemStorage`, attempting to delete
a nonexistent file can cause an exception (as in #80). We want to avoid
these errors but don't want to suppress others raised in the process of
deleting the file, so we first check to see if the file exists.
2011-12-07 00:52:06 -05:00
Matthew Tretter
081a0a0d0f No need to check for None
`get_spec_files` will never return it.
2011-12-07 00:37:52 -05:00
Kevin Postal
eda3fc3c91 Catch KeyError on image.info dictionary 2011-12-06 23:29:30 -05:00
Matthew Tretter
8bab75b331 Merge pull request #66 from matthewwithanm/trimcolor-processor
Processor for trimming solid-color borders
2011-12-06 10:04:39 -08:00
Matthew Tretter
358bb1f6b0 Using difference instead of subtract
This corrects the border removal, however, I'm not certain whether the
interpretation of "tolerance" gels with expectations.
2011-12-06 12:56:50 -05:00
Matthew Tretter
96878105e9 Indentation tweak 2011-12-02 02:46:27 -05:00
Matthew Tretter
eb425fbae9 Makes evaluation of source_file lazy
This paves the way for future updates that will fix bugs related to
specs not reflecting updates to their source image fields.
2011-12-02 02:28:08 -05:00
Timothée Peignier
54d5237adc avoid Transpose to crash when exif data doesn't exists 2011-11-28 16:00:34 +01:00
Matthew Tretter
ee1fb7f943 Allows None value for processors argument
Fixes #70
2011-11-23 19:34:59 -05:00
Matthew Tretter
5ecdeb1209 Remove _Resize class
It once had a purpose, but it hasn't for a while.
2011-11-22 23:41:18 -05:00
Matthew Tretter
25be1f66ca Explicitly import crop module
So you can `import crop from imagekit.processors`
2011-11-16 15:17:11 -05:00
Matthew Tretter
ed64032762 Renames processor to TrimBorderColor 2011-11-16 15:16:24 -05:00
Matthew Tretter
62d39ccf9e Gives precedence to user options
Previously, options set by `AutoConvert` had higher precedence than
those explicitly passed by the user. This corrects that.
2011-11-16 10:27:18 -05:00
Matthew Tretter
788365d6db Replaces quality argument with options dict
The `options` argument for `ImageSpec` and `ProcessedImageField`
replaces `quality` and provides a more general solution, allowing the
user access to PIL's format-specific options (including "quality",
"progressive", and "optimize" for JPEGs).
2011-11-16 10:00:35 -05:00
Matthew Tretter
cfd503a2eb TrimColor processor 2011-11-16 00:11:05 -05:00
FI$H 2000
7ce43309ad Adds SmartCrop resize processor, with tests. 2011-11-10 10:54:58 -05:00
Bryan Veloso
78709be23c We're at 1.1.0dev, for real this time. 2011-11-10 15:39:47 +09:00
Bryan Veloso
83cc7f4cc3 Bumping version numbers. 2011-11-10 15:30:01 +09:00
Matthew Tretter
7e5491cc3e Reset file pointer before opening image. Fixes #47 2011-11-08 20:53:48 -05:00
Matthew Tretter
cfa3d01f54 Rename _create() to generate()
After #51 presented a good use case, we decided to make this part of
the API (i.e. remove the underscore). The default value for the `lazy`
kwarg is changed to `True` to reduce the likelihood of accidental
regeneration of images. Closes #54.
2011-11-07 23:07:09 -05:00
Matthew Tretter
8c9a9b8d5c AutoConvert processor
At first, we only had a small amount of code for preserving
transparency in `img_to_fobj`, but as that code grew it became apparent
that it really didn't belong in the utility function. This commit
creates an `AutoConvert` processor which is automatically run before
saving unless you disable it by passing `autoconvert=False` to your
`ImageSpec` or `ProcessedImageField` constructor. `img_to_fobj` is once
again a simple utility function for creating a file object from a PIL
image.
2011-11-06 21:44:31 -05:00
Matthew Tretter
f4b9d74335 Smarter transparency handling
The in-code comments explain it pretty thoroughly but, in short, this
handles a lot more of the situations in which you're converting to or
from formats that support transparency.
2011-11-06 01:19:32 -05:00
Matthew Tretter
8911836b53 Change how we set ImageFile.MAXBLOCK
Previously, we set it to an arbitrary large number (which turned out
not to be large enough in some cases). Since we may have been
overriding something the user explicitly chose (and our value may be
overridden by another app), that probably wasn't good. After this
change, `MAXBLOCK` is only increased when it needs to be--and even
then, only temporarily.
2011-11-05 21:20:36 -04:00
Matthew Tretter
7ab1d08e49 Merge pull request #52 from islavov/patch-1
FIX: RGBA mode breaks transparency check
2011-11-05 11:55:10 -07:00
iu_long
ae8a3b8ef8 RGBA is a transparent image mode too . When saving RGBA, you cannot specify 'transparency' color - you get IOError wrong mode. 2011-11-05 18:25:17 +02:00
Matthew Tretter
dd7ae5a8e4 Increase MAXBLOCK on save failure
Under certain circumstances, saving a JPEG may fail if MAXBLOCK isn't
large enough, so we (temporarily) increase it. This should fix #50.
2011-11-04 22:43:41 -04:00
Bryan Veloso
486fb51a1e Merge pull request #49 from cyberdelia/fix-empty-exif-data
Avoid Transpose to crash when there is no exif data.
2011-11-04 04:50:19 -07:00
Timothée Peignier
a0f2db4d29 avoid Transpose to crash when there is no exif data 2011-11-04 12:00:19 +01:00
ptone
18349a053f Try to better handle being passed a open file with write mode enabled
such as would be the case with tempfile.mkstemp etc
2011-11-04 00:11:22 -07:00
Matthew Tretter
dd642fd05b format_to_extension correctly handles None arg 2011-11-03 15:00:40 -04:00
Matthew Tretter
3022eb037d Proper handling of empty images and missing fields
Fixes #42
2011-11-03 12:33:22 -04:00
Matthew Tretter
bbc0bffd88 Fixes error message
Arguments were in the wrong order. Also, shows class name in string
representation of instance isn't helpful.
2011-11-03 12:26:23 -04:00
Bryan Veloso
44392b7b24 Bumping version numbers. 2011-11-03 14:15:03 +09:00
Matthew Tretter
f1b1f2ec71 Fix in format_to_extension mapping 2011-11-02 12:21:45 -04:00
Matthew Tretter
14bac58373 On-demand loading of PIL plugins 2011-11-02 11:26:24 -04:00
deepakprakash
d36e624acb Fix conversion of PNG "palette" or "P" mode images to JPEG.
"P" mode images need to be converted to 'RGB' if target image format is not PNG or GIF.
2011-11-02 14:25:22 +05:30
Bryan Veloso
5985def06b Back to dev. 2011-11-02 13:49:17 +09:00