Commit graph

27 commits

Author SHA1 Message Date
Matthew Tretter
7e5491cc3e Reset file pointer before opening image. Fixes #47 2011-11-08 20:53:48 -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
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
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
6adadafc74 PEP8 and import tweaks. 2011-10-20 12:12:47 +09:00
Bryan Veloso
302399d837 Merge branch 'new_api' of https://github.com/matthewwithanm/django-imagekit into release/1.0.0
* 'new_api' of https://github.com/matthewwithanm/django-imagekit: (63 commits)
  fixing typo
  ImageSpecFile is a proper File
  Typo fix
  A list of ImageSpec names are now stored on the model.
  AdminThumbnailView is now AdminThumbnail
  Docs typo fix
  Adds explicit import of resize module to processors
  fixing bad import in docs
  adding name to AUTHORS
  adding test for new api
  Moved Crop and Fit to resize module.
  More docs edits.
  Typo fix.
  Installation instructions.
  Embracing duck typing.
  Documentation!
  Fix bug
  Bound fields are now cached on the model instance.
  Transpose processor now supports auto EXIF orientation.
  Fix filename formatting.
  ...

Conflicts:
	AUTHORS
	README.rst
	docs/Makefile
	docs/conf.py
	docs/index.rst
	imagekit/__init__.py
	imagekit/defaults.py
	imagekit/management/commands/ikflush.py
	imagekit/models.py
	imagekit/options.py
	imagekit/processors.py
	imagekit/specs.py
	tests/core/tests.py
2011-10-20 12:06:10 +09:00
Bryan Veloso
2d4f116e57 Whitespacing and PEP8-ing. 2011-10-11 02:16:22 +09:00
Eric Eldredge
b8e57dccd6 A list of ImageSpec names are now stored on the model.
Previously, ImageSpecFile instances were retrieved (for saving and deleting,
among other possibilities) by iterating over the model instance's attributes.
This change adds ImageSpecFile names to a list (spec_file_names) on an
imagekit meta object on the model (_ik), making later retrieval much cheaper
and more straightforward.
2011-10-06 16:08:14 -04:00
Ryan Bagwell
ff07e4e247 dynamically getting colors, instead of setting it to 255 2011-09-25 17:53:51 -05:00
Ryan Bagwell
b96a3f53a5 adding transparency patch to preserve transparency when saving the image 2011-09-25 15:49:32 -05: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
Matthew Tretter
e190e78df5 Rename fields module to models. 2011-09-23 18:06:28 -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
305d20569c Moved get_bound_specs to utils. 2011-09-21 20:17:23 -04:00
BaBaBags
db95e63a63 Added support for preserving transparency when converting from color to greyscale 2011-08-23 10:20:37 -04:00
Shanto
6b1aff64c2 Fixes: CMYK files from Photoshop fails to load with exception -2 2011-06-17 13:13:20 -07: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/utils.py (Browse further)