Commit Graph

71 Commits

Author SHA1 Message Date
Alex Clark ☺
cd1cc66d4d Merge pull request #73 from pelson/tiff_tags
Added the ``named`` method to a Tiffs tag getter.
2013-03-07 05:51:39 -08:00
Phil Elson
603f2a226f Added the `named` method to a Tiffs tag getter. 2013-03-07 12:00:19 +00:00
Mikhail Korobov
c59c6609f3 Restore fromstring & tostring aliases in 3.x 2013-03-07 15:23:40 +06:00
Kyle MacFarlane
de17144f6b Fix Ghostscript command on Windows 2013-03-06 17:36:22 +00:00
Alex Clark ☺
001a1521cb Merge pull request #64 from kmike/master
Testing improvements and better Python 3.x support
2013-03-05 12:11:07 -08:00
Alex Clark ☺
d58006af39 Merge pull request #57 from garnertb/exif_tags
Updated tags to the 2.3 standard and fixed spelling error in the comment...
2013-03-05 12:03:24 -08:00
Alex Clark ☺
d097fa068c Merge pull request #56 from cgohlke/patch-4
BUG: PIL Image array interface has the wrong size for YCbCr
2013-03-05 12:02:05 -08:00
Alex Clark ☺
9ed98814ce Merge pull request #53 from cgohlke/patch-1
BUG: Windows image viewer unable to open image
2013-03-05 10:47:45 -08:00
Mikhail Korobov
a71183dab5 better fix for #15 (with a test case now) 2013-02-26 17:12:11 +06:00
Mikhail Korobov
ee794e1501 An attempt to fix #15 for Python 3.x.
TiffImagePlugin.ImageFileDirectory.__getattr__ is magical because it deletes items from "tagdata" variable and this plays badly with TiffImagePlugin.ImageFileDirectory.__iter__. Under Python 2.x items() returned a list and this wasn't a problem (because __iter__ value was evalued once); under Python 3.x items() returns a view/iterator that chains self.tags and self.tagdata and iteration begins to fail with "RuntimeError: dictionary changed size during iteration" exception because tagdata item is modified.

In this changeset I've tried to fix this by evaluating items() when the loop starts (by casting it to list), so that it doesn't matter if tagdata is changed during iteration or not.

There is no tests because _getexif is currently private. But this method is used by easy-thumbnails and sorl.thumbnails, so I think it is worth fixing it.
2013-02-26 16:44:47 +06:00
Mikhail Korobov
bb4eb53859 fix UnboundLocalError errors 2013-02-26 16:31:44 +06:00
Mikhail Korobov
aacb8097c3 better warning messages for fromstring/tostring 2013-02-26 16:19:35 +06:00
Tyler Garner
fa2b10d5da Updated tags to the 2.3 standard and fixed spelling error in the comments. 2013-02-16 11:16:16 -05:00
Christoph Gohlke
bb07471d2e BUG: PIL Image array interface has the wrong size for YCbCr 2013-02-13 19:52:32 -08:00
Christoph Gohlke
dbf3d993ed BUG: Windows image viewer unable to open image
The issue was reported several times during the past years.
The temporary bitmap file is deleted before the image viewer is started. The workaround is to wait some time before deleting the file.
http://stackoverflow.com/questions/4607633/image-format-to-save-in-python
http://stackoverflow.com/questions/7715501/pil-image-show-doesnt-work-on-windows-7
2013-02-13 18:23:30 -08:00
Alex Clark
cb4f0f2b3c Revert "Fix saving images with added transparency"
This reverts commit cc439099c1.
2013-02-06 09:25:03 -05:00
Sandro Mani
cc439099c1 Fix saving images with added transparency
See http://mail.python.org/pipermail/image-sig/1999-February/000648.html
This patch was carried by fedora for python-imaging
2013-02-06 00:49:26 +01:00
David Schmidt
5baa1ac1b8 Added support for PNG images with transparency palette 2013-02-01 17:52:22 +01:00
David Schmidt
e90d90d60a Fixed another PIL Pillow difference bug 2013-01-11 14:41:38 +01:00
David Schmidt
33bf5d9d37 Improved load truncated images 2013-01-11 14:40:02 +01:00
David Schmidt
ee04c7ceea Fixed another difference between PIL and Pillow 2013-01-11 13:24:44 +01:00
d-schmidt
addf0f4d95 Added possibility to save exif information in jpeg-files 2013-01-10 21:36:21 +01:00
d-schmidt
54d4f5eb3c added option to load truncated image-files 2013-01-10 20:44:41 +01:00
d-schmidt
900f3a8ff7 Added possibility to save gifs with a custom palette when using color mode P 2013-01-10 20:34:58 +01:00
Brian J. Crowell
c952134e00 py3k: Issue warnings when using the old fromstring/tostring
...although, you have to turn on deprecation warnings specifically in order
to get them.
2013-01-10 08:47:05 -06:00
Brian Crowell
848579af9b py3k: Add Windows icon sanity test 2013-01-10 08:47:04 -06:00
Brian Crowell
276cc421f7 py3k: Add XPM read test
This test includes an XPM file with transparency.
2013-01-10 08:47:03 -06:00
Brian Crowell
d6a0dec15b py3k: Add TarIO test
Not too convinced of the size fix. While it works against my file, I'm not
sure someone would have accidentally been an index off and not noticed.
2013-01-10 08:47:03 -06:00
Brian Crowell
49b0d1563e py3k: Rewrite PdfImagePlugin into something more legible
After adding all the encode() calls, the PDF plugin (and a few others)
became much harder to read. This should be much easier on the eyes.
2013-01-10 08:47:02 -06:00
Brian Crowell
6765b8e026 py3k: Add .FLI sanity check, and fix palette bytes bug 2013-01-10 08:47:01 -06:00
Brian Crowell
4f7d784a71 py3k: Actually fix the EPS encoder
The EPS encoder wasn't part of Gohlke's test suite, so the previous "fixes"
there were only expected syntactic ones. This gives a cleaner fix to the
encoder.

The decoder doesn't work in round-trip due to a missing eps_decoder method
on the core module, but it's clear it worked at some point.
2013-01-10 08:47:00 -06:00
Brian Crowell
63be4a1334 py3k: Get rid of _ParserFile; io.BytesIO does its job 2013-01-10 08:46:59 -06:00
Brian Crowell
8035b1a76a py3k: FIX: TGA missing o8 declaration
Plus, TGA was eligible for a round-trip test in test_imagefile. It has one
now.
2013-01-10 08:46:59 -06:00
Brian Crowell
254f0cf674 py3k: FIX: Bad upside-down check in BmpImagePlugin 2013-01-10 08:46:58 -06:00
Brian Crowell
a7e3b2e47b py3k: The big push
There are two main issues fixed with this commit:

* bytes vs. str: All file, image, and palette data are now handled as
  bytes. A new _binary module consolidates the hacks needed to do this
  across Python versions. tostring/fromstring methods have been renamed to
  tobytes/frombytes, but the Python 2.6/2.7 versions alias them to the old
  names for compatibility. Users should move to tobytes/frombytes.

  One other potentially-breaking change is that text data in image files
  (such as tags, comments) are now explicitly handled with a specific
  character encoding in mind. This works well with the Unicode str in
  Python 3, but may trip up old code expecting a straight byte-for-byte
  translation to a Python string. This also required a change to Gohlke's
  tags tests (in Tests/test_file_png.py) to expect Unicode strings from
  the code.

* True div vs. floor div: Many division operations used the "/" operator
  to do floor division, which is now the "//" operator in Python 3. These
  were fixed.

As of this commit, on the first pass, I have one failing test (improper
handling of a slice object in a C module, test_imagepath.py) in Python 3,
and three that that I haven't tried running yet (test_imagegl,
test_imagegrab, and test_imageqt). I also haven't tested anything on
Windows. All but the three skipped tests run flawlessly against Pythons
2.6 and 2.7.
2013-01-10 08:46:56 -06:00
Brian Crowell
275a895952 py3k: Type coercion is gone
Types aren't automatically converted for operations for you.
2013-01-10 08:46:55 -06:00
Brian Crowell
80c2fa60ae py3k: Sort by key, not cmp
Py3k only supports key because it's more efficient. Not even sure 2to3
checks for this.
2013-01-10 08:46:54 -06:00
Brian Crowell
af94e2d93d py3k: Map long type to int
int() is really now long() in py3k, but to avoid breaking 2.6/2.7, we leave
the integer types where they are and just map long to int in py3k.

Also, pretty proud of myself for finding an easy way of detecting py3k.
2013-01-10 08:46:54 -06:00
Brian Crowell
31c454b925 py3k: 2to3's "idiom" filter
This is, I guess, a few things the Python devs were just fed up with.

* "while 1" is now "while True"
* Types are compared with isinstance instead of ==
* Sort a list in one go with sorted()

My own twist is to also replace type('') with str, type(()) with tuple,
type([]) with list, type(1) with int, and type(5000.0) with float.
2013-01-10 08:46:53 -06:00
Brian Crowell
48cf699fe6 py3k: Change apply() to unpacking syntax
apply() is no longer available in py3k.
2013-01-10 08:46:52 -06:00
Brian Crowell
e2283c664b py3k: Integer long literals are no longer valid syntax 2013-01-10 08:46:52 -06:00
Brian Crowell
260c1fad14 py3k: Convert StringIO.StringIO to io.BytesIO
io.BytesIO is already in 2.6. Some of the more obvious bytes literals are
marked in this commit.
2013-01-10 08:46:51 -06:00
Brian Crowell
dda0e9a3ed py3k: Tkinter module is now tkinter 2013-01-10 08:46:51 -06:00
Brian Crowell
fa348ee9fe py3k: __builtin__ module is now builtins 2013-01-10 08:46:50 -06:00
Brian Crowell
dfb1b144d8 py3k: Remove Image types import
For awhile now, str == type("") and so on. So we use the appropriate int,
str, basestring, or tuple type where applicable.
2013-01-10 08:46:49 -06:00
Brian Crowell
83ff0b3b31 py3k: Use relative imports
In py3k, imports are absolute unless using the "from . import" syntax.

This commit also solves a recursive import between Image, ImageColor, and
ImagePalette by delay-importing ImagePalette in Image.

I'm not too keen on this commit because the syntax is ugly. I might go back
and prefer the prettier "from PIL import".
2013-01-10 08:46:48 -06:00
Brian Crowell
abd215e457 py3k: Remove tuples in parameter lists
Py3k no longer supports unpacking tuples in the parameters.
2013-01-10 08:46:47 -06:00
Brian Crowell
5076c35cc5 py3k: print is a function
Seriously, if you didn't know that, you've been in a freaking cave, man.
2013-01-10 08:46:46 -06:00
Brian Crowell
aeab3f5911 py3k: Import reduce function
reduce() is no longer a built-in function in py3k.
2013-01-10 08:46:46 -06:00
Brian Crowell
da1d715b8e py3k: Use isinstance for numbers and sequences
operator.isNumberType() and .isSequenceType() go away in py3k.
2013-01-10 08:46:45 -06:00