Commit Graph

1615 Commits

Author SHA1 Message Date
paddywwoof
25b39de5b7 ImageColor defaults to alpha = 255 in only rgb specified for RGBA mode 2013-09-19 15:30:08 +01:00
Alex Clark ☺
e5279a284b Merge pull request #325 from manisandro/bytearray
Fix bytes which should be bytearray
2013-08-29 02:14:49 -07:00
Sandro Mani
1c4734b6bb Make bytePalette read-only buffer 2013-08-28 20:44:27 +02:00
Sandro Mani
4be146cf27 Fix bytes which should be bytearray 2013-08-28 20:18:13 +02:00
Alex Clark ☺
07f338f194 Merge pull request #315 from d-schmidt/master
fix Issue #312 + gif optimize improvement
2013-08-22 02:54:43 -07:00
wiredfool
bb29d00fdf Merge pull request #321 from vytisb/master
Fix for #318: Catch truncated zTXt chunk errors when decoding PNG images.
2013-08-21 15:02:03 -07:00
Eric Buehl
26fb0eadad issue warning instead of debug/print 2013-08-20 16:53:55 +00:00
Vytis Banaitis
dbf40a0124 Catch truncated zTXt errors. 2013-08-20 15:17:17 +03:00
Eric Buehl
7430dc261f be more tolerant of tag read failures
this can occur if the MakerNote has a pointer to outside the EXIF block
2013-08-19 22:51:50 +00:00
David Schmidt
9d43f156a8 replace custom search with dict in gif optimize 2013-08-06 11:36:02 +02:00
David Schmidt
c9df9d0b23 reorganized gif optimize to work with palette parameter 2013-08-05 17:59:35 +02:00
David Schmidt
b9ab3f5bf4 fix Issue #312
improve palette handling while saving gif and png
2013-08-02 16:32:49 +02:00
Joaquín Cuenca Abela
c68044bf7f Fix IOError when saving progressive JPEGs.
when the jpeg encoder sees the flags optimize or progressive (or progression)
it will write the full image in one shot.

The bufsize needs to be big enough to hold the entire image. The current heuristic
is that the entire compressed image will fit in width * height bytes, but this
heuristic is only applied to save operations with the flag "optimize" and not to
save operations with the flag "progressive".

This patch fixes this oversight.

(Btw, it will probably be a good idea to have a loop that retries with a bigger
bufsize in case this guess is not big enough.)
2013-08-02 14:36:46 +02:00
Yoav Weiss
c117dcae34 Add RGBA support to ImageColor 2013-07-30 16:43:40 +02:00
Martijn Pieters
97f1cd55ee Fix for #304: test for str, not "utf-8".
The code wants to produce a `str` object for the given Python version (which is the right thing to do here).
2013-07-25 18:21:08 +01:00
Michał Nowotka
702fc75ee3 Update _util.py
Fixing missing import.
2013-07-25 17:25:18 +01:00
Felipe Reyes
64cc8f994d Added some missing exif tags 2013-07-24 18:46:21 +00:00
wiredfool
e3e0638a5f Fail fast if there's an import error on _imaging 2013-07-23 10:17:15 -07:00
Freek Dijkstra
d24a419299 Warnings if imaging library has wrong UCS support.
Raise exceptions for unknown errors.
2013-07-23 10:44:27 +02:00
lmollea
763be8614d Fixed windows fallback (wasn't using correct file in windows/fonts) 2013-07-22 14:44:40 +02:00
Felipe Reyes
a560022341 Transformed docstrings of ImageFile and ImageFileIO modules 2013-07-19 15:11:26 +00:00
wiredfool
db49dbf9de Ignore fillorder=2 when reading using libtiff 2013-07-10 22:36:55 -07:00
Felipe Reyes
15eac684c4
Moved Image module docs from comments to docstrings 2013-07-09 15:12:28 -04:00
Alex Clark ☺
675b4d433c Merge pull request #280 from freyes/add-docstrings-Image
Moved PIL.Image.Image docs from comments to docstrings
2013-07-09 09:15:15 -07:00
Felipe Reyes
25b6371b75
Moved PIL.Image.Image docs from comments to docstrings 2013-07-09 10:32:14 -04:00
wiredfool
c575dff007 ignore high ascii characters in string.whitespace 2013-07-08 22:16:25 -07:00
Bernardo Heynemann
b4735f7829 Adding support for metadata in webp images.
Pillow now uses the webpmux library to envelop the webp images in RIFF. This allows for easy support of exif and icc_profile metadata.

Also included tests that verify compatibility with jpeg for exif and icc_profile metadata.

If the user does not have webp with webpmux enabled, pillow will fall back to the previous approach, meaning no exif or icc_profile metadata will be read or written to.
2013-07-04 18:04:07 -03:00
Alex Clark ☺
fd98b0cceb Merge pull request #268 from megabuz/master
Add several TIFF decoders and encoders
2013-07-01 09:14:43 -07:00
Alexey Buzanov
a130c45990 add several TIFF decoders and encoders 2013-07-01 18:45:42 +04:00
Chris Bailey
08d0ec1e93 Generalizing pterk's ZeroDivisionError fix for 1px images 2013-07-01 12:36:46 +01:00
Alex Clark ☺
3207bf372a Merge pull request #266 from cgohlke/remove-test_imagegl
Remove useless ImageGL module
2013-07-01 03:32:27 -07:00
Christoph Gohlke
f042fd6af3 remove useless ImageGL module 2013-06-30 20:39:12 -07:00
Alex Clark
bb1b3a532c Cleanup WS, courtesy of @Arfrever
find * -type f "-(" -name "*.bdf" -o -name "*.c" -o -name "*.h" -o -name "*.py" -o -name "*.rst" -o -name "*.txt" "-)" -exec sed -e "s/[[:space:]]*$//" -i {} \;
2013-06-30 18:42:19 -04:00
Alex Clark
f56facb0c1 Clean up 2013-06-30 15:21:37 -04:00
Alex Clark
c6a95bf8f4 Add files 2013-06-30 14:50:38 -04:00
Alex Clark
fd29e707e9 Apply @Arfrever patch, fixes #258 2013-06-30 07:04:42 -04:00
Alex Clark ☺
19ad775140 Merge pull request #243 from kostya0shift/master
Better support for ICO files
2013-06-29 16:02:11 -07:00
Peter van Kampen
ad0a96c3fa add test & comment 2013-06-23 15:22:31 +02:00
Peter van Kampen
c9faa9caa5 Fix for ZeroDivisionError in ImageOps.fit for image.size == (1,1) 2013-06-23 12:33:23 +02:00
kostya0shift
738a1dd777 Better support for ICO images 2013-06-05 21:01:05 +04:00
wiredfool
aad417dcbe Merge pull request #229 from wiredfool/warnings
Fixing and Suppressing warnings revealed in #227
2013-05-24 08:36:57 -07:00
Alex Clark ☺
5c11e27a97 Merge pull request #228 from d-schmidt/master
working gif optimization
2013-05-24 05:59:23 -07:00
David Schmidt
b66d888b0e adjust the transparency index after successful optimize
skip transparency block if transparent color is not used after optimize
2013-05-24 13:12:40 +02:00
David Schmidt
71b30352d9 limit custom palette size 2013-05-24 13:16:16 +03:00
David Schmidt
a9cb1281f4 fix Python 2 compatibility 2013-05-24 11:55:31 +02:00
wiredfool
2322619372 fixed deprecation warnings for tostring on array.array 2013-05-23 10:33:27 -07:00
David Schmidt
12cea19280 a break 2013-05-23 15:45:11 +02:00
David Schmidt
dad5e86226 fix gif test, fix gif optimization for palette length < 3 2013-05-23 15:24:06 +02:00
Alex Clark ☺
a9fd1f4a94 Merge pull request #225 from wiredfool/pr224
Fix Image.fromarray with NumPy arrays: Supersedes PR #224
2013-05-23 05:51:58 -07:00
David Schmidt
5cd1b9f01e minor addition 2013-05-23 14:31:48 +02:00
David Schmidt
a466b3e099 fixes #211
replace the gif optimization with a working version
2013-05-23 14:06:09 +02:00
wiredfool
baba2810ae version updates 2013-05-21 21:46:36 -07:00
wiredfool
b3752ca053 merge from master 2013-05-21 21:29:58 -07:00
wiredfool
587b9a79d8 ducktype the array_interface obj to see if it provides tobytes or tostring 2013-05-21 21:04:22 -07:00
Matt Davis
1082173030 Fix Image.fromarray with NumPy arrays
Image.fromarray attempts to call a method called `tobytes()` on the passed in object, but NumPy arrays don't have a `tobytes()` method, they have a `tostring()` method. (See http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.tostring.html).

I think this was changed accidentally in a Python 3 compatibility update in which this call was confused with the `tobytes` and `frombytes` methods of Image objects.
2013-05-21 18:35:11 -03:00
Alex Clark ☺
1c3ff8857a Merge pull request #220 from wiredfool/weba_transparent
Transparent WebP Support, #204
2013-05-16 12:49:02 -07:00
Alex Clark ☺
aea9570a2c Merge pull request #221 from wiredfool/jpeg_memoryleak
Jpeg Decode memory leak fix.
2013-05-16 12:42:45 -07:00
wiredfool
158cdbe8db Enabling cleanup
Enabling the cleanup call in ImageFile.load
2013-05-16 08:32:24 -06:00
wiredfool
f6381ba00c Added cleanup method to prevent memory leaks from truncated jpeg decodes 2013-05-15 21:16:37 -07:00
wiredfool
89b6820530 checking raw image length, cleanup and DRY 2013-05-15 17:04:17 -07:00
wiredfool
11a0fb5f76 consolidated to WebPEncode_wrapper 2013-05-15 16:56:59 -07:00
wiredfool
37359369ce Code to ensure buffer space for exif write and jpeg_write_scanline calls, tests, corrected buffer length calculation 2013-05-14 22:29:31 -07:00
wiredfool
071b8e6b46 Merge branch 'master' into maxblock 2013-05-14 20:37:21 -07:00
wiredfool
b52c22316f inprogress, sorta working 2013-05-13 20:50:10 -07:00
wiredfool
3273b0c4b9 Merge branch 'master' of https://github.com/euangoddard/Pillow into weba_transparent 2013-05-13 09:54:34 -07:00
wiredfool
310341cec7 merge from master 2013-05-13 09:17:52 -07:00
Euan Goddard
1344610a52 Added support for alpha transparent webp images #204 2013-05-13 17:01:42 +01:00
Angel Nunez Mencias
4e9a8ef7d7 Use the JPEG Plugin save instead of calling the ImageFile directly 2013-05-12 02:34:07 +02:00
Matti Picus
af94b45cbc allow integer image resolution as well as rational 2013-05-07 23:33:21 +03:00
Matti Picus
5ca04bb728 a test that fails for images with integer resolution 2013-05-07 23:23:51 +03:00
wiredfool
39c62f76ab Buffer lifetime needs to be the same as the font lifetime 2013-04-25 21:17:58 -07:00
Nicolas Pieuchot
028e63865e Changing bytes variable name not to squeeze bytes type 2013-04-25 23:03:37 +02:00
Nicolas Pieuchot
4d136d94ce Better unity with Image.py file (on string type testing and warnings) 2013-04-25 22:32:43 +02:00
Nicolas Pieuchot
282562ec19 Adding Python3 basestring compatibility without changing basestring 2013-04-25 22:03:37 +02:00
Nicolas Pieuchot
f1c245c9c5 Deprecation message correction 2013-04-25 21:10:42 +02:00
Nicolas Pieuchot
af72132349 Correction of the unbufferizing 2013-04-25 20:57:13 +02:00
Nicolas Pieuchot
450a068ccb Removing buffer from imagefont 2013-04-25 18:48:43 +02:00
Nicolas Pieuchot
ed9945c71f Allowing to pass font as file-like objects 2013-04-22 11:48:06 +02:00
wiredfool
026f6bb61e namespaced operation works when installed as a zipped egg using 'sudo python[3] setup.py easy_install -l --zip-ok .' 2013-04-15 10:57:37 -07:00
Sandro Mani
194370d89b Fix some docstrings 2013-04-12 21:54:21 +02:00
wiredfool
b0fffd24a4 Merge branch 'master' of https://github.com/python-imaging/Pillow into namespaced 2013-04-09 12:08:13 -07:00
David Schmidt
836e3e05d8 create a palette before converting transparent L-Mode to RGBA
fixes #154
2013-04-09 13:21:38 +02:00
wiredfool
8295e33390 moved _webp into the PIL namespace 2013-04-08 21:53:59 -07:00
wiredfool
088c752e40 basic sanity check that the version of the _imaging.c and Image.py files are the same 2013-04-08 21:43:15 -07:00
wiredfool
7f698a6fc5 PIL imports work in python3/Ubuntu 2013-04-08 20:55:06 -07:00
wiredfool
c774f9ab4c merged pull request #88 to master, resolved conflicts 2013-04-08 20:31:28 -07:00
wiredfool
7200c40ada s/tabs/spaces/ 2013-04-05 15:57:07 -07:00
wiredfool
a4a856b58a large exif segments 2013-04-05 15:36:48 -07:00
wiredfool
7129baa9b2 fix for if isinstance(filter, collections.Callable) crash. Python bug #7624 on <2.6.6 2013-03-27 09:44:54 -07:00
Ronald Oussoren
f50feb592b Explitly import JpegPresets from the PIL package 2013-03-26 13:36:13 +01:00
wiredfool
2a743c9527 JpegImagePlugin sets bufsize for optimized images 2013-03-22 22:27:12 -07:00
David Schmidt
511adfacf7 fix png decode tRNS pattern 2013-03-21 21:00:25 +01:00
David Schmidt
ecd55629be fix indention 2013-03-21 18:47:37 +01:00
David Schmidt
1a40613ca5 fix indention 2013-03-21 18:43:22 +01:00
David Schmidt
09315f263b fixing save of transparency palette png-images 2013-03-21 18:16:00 +01:00
David Schmidt
1ff2b6630a fixed bug with png-images with transparency palette 2013-03-21 16:54:04 +01:00
wiredfool
754eb19d9d Fixing deprecation warning on py26 2013-03-19 13:53:37 -07:00
Christoph Gohlke
1f41e25b4f Fix AttributeError: 'module' object has no attribute 'isNumberType' 2013-03-16 09:16:54 -07:00
wiredfool
1540d46ca9 support for the differences between StringIO and BytesIO 2013-03-14 10:36:15 -07:00
Alex Clark ☺
ae45b38286 Merge pull request #112 from cgohlke/patch-9
Support uint32 TIFF
2013-03-14 03:55:14 -07:00
Christoph Gohlke
64c25bcf89 Compare prefix to byte strings 2013-03-13 23:28:30 -07:00
Christoph Gohlke
dbfaff5673 Support uint32 TIFF 2013-03-13 21:08:24 -07:00
Christoph Gohlke
b9b6972097 Use BytesIO instead of StringIO 2013-03-13 19:42:21 -07:00
Christoph Gohlke
a26d7b6261 Decode bytestr instead of str 2013-03-13 19:18:40 -07:00
Christoph Gohlke
0df7744845 Fix imports 2013-03-13 19:03:38 -07:00
Alex Clark ☺
8ee5dc3056 Merge pull request #106 from cgohlke/patch-4
Better import of _imagingagg and ImageDraw2
2013-03-13 18:03:30 -07:00
Christoph Gohlke
a442d5fa06 Better import of _imagingagg and ImageDraw2 2013-03-13 18:01:15 -07:00
Alex Clark ☺
6c565e980f Merge pull request #105 from cgohlke/patch-3
Better import of Tkinter
2013-03-13 18:00:38 -07:00
Christoph Gohlke
706812ec87 Better import of Tkinter 2013-03-13 17:58:11 -07:00
Christoph Gohlke
4985d96d03 Better import of _imagingft 2013-03-13 17:56:33 -07:00
Alex Clark ☺
62bb9aaaa2 Merge pull request #98 from wiredfool/g4_support
G4 Tiff support
2013-03-13 15:41:33 -07:00
Alex Clark ☺
bb186fe516 Merge pull request #96 from lqs/master
add support for webp
2013-03-13 04:39:42 -07:00
wiredfool
7226d0dc26 Merge branch 'master' into g4_support 2013-03-12 22:24:36 -07:00
Oliver Tonnhofer
2d478fe82a fixed check for str with Python 3 2013-03-12 21:29:46 +01:00
Liu Qishuai
a49ea5d326 add support for webp 2013-03-12 22:30:59 +08:00
wiredfool
a3b4697965 typo 2013-03-11 22:04:34 -07:00
Oliver Tonnhofer
6a450e303d reduce PNG palette size for images <255 colors
limit color and trancparency palette to 2^bits entries, when a PNG is
saved with the 'bits' PNG encoder option
2013-03-11 20:58:54 +01:00
Oliver Tonnhofer
6537ba19c3 backport PIL's PNG/Zip improvements
- add new FASTOCTREE quantizer with alpha support
- make ZIP compress level and type configurable
- support reading/writing PNGs with paletted alpha

source 3637439d51
2013-03-11 20:33:04 +01:00
Oliver Tonnhofer
c60bb09fcd Revert "Added support for PNG images with transparency palette"
This reverts commit 5baa1ac1b8.
2013-03-11 19:02:54 +01:00
Oliver Tonnhofer
1db3f9d53f Revert "Fix KeyError in Tests/test_file_xpm.py"
This reverts commit b29326b175.
2013-03-11 19:02:44 +01:00
wiredfool
4f2a1f9715 () for print, since we're using print_statement 2013-03-08 21:15:22 -08:00
wiredfool
5ba6564e26 initial merge of wiredfool/Python-Imaging-Library-G4-Tiff-Support 2013-03-08 19:51:59 -08:00
Alex Clark
6999860786 Revert "Use relative import for _imagingagg"
This reverts commit 34a5311e1b.
2013-03-08 18:43:52 -05:00
Alex Clark
de077c9d37 Revert "Use relative import for _imagingtk"
This reverts commit 5820716eb3.
2013-03-08 18:43:00 -05:00
Alex Clark
6e00a9c355 Revert "Use relative import for _imaginggl"
This reverts commit 5e203de327.
2013-03-08 18:42:21 -05:00
Alex Clark
4546d26413 Revert "Better import for _imagingft"
This reverts commit 089a04bce1.
2013-03-08 18:41:19 -05:00
Alex Clark
44d25a238c Revert "Use relative import for _imagingcms"
This reverts commit 1003e4f7ee.
2013-03-08 18:40:21 -05:00
Alex Clark
cbb93ac5bf Revert "Use relative import for _imagingmath"
This reverts commit c731513318.
2013-03-08 18:39:17 -05:00
Alex Clark
33f42c7fbd Revert "Use relative import for _imaging"
This reverts commit aff6eccec5.
2013-03-08 18:38:26 -05:00
Alex Clark
fd81ee9336 Fix imports 2013-03-08 17:39:50 -05:00
Christoph Gohlke
34a5311e1b Use relative import for _imagingagg 2013-03-08 13:47:41 -08:00
Christoph Gohlke
5820716eb3 Use relative import for _imagingtk 2013-03-08 13:43:43 -08:00
Christoph Gohlke
c731513318 Use relative import for _imagingmath 2013-03-08 13:40:30 -08:00
Christoph Gohlke
5e203de327 Use relative import for _imaginggl 2013-03-08 13:38:37 -08:00
Christoph Gohlke
089a04bce1 Better import for _imagingft 2013-03-08 13:36:32 -08:00
Christoph Gohlke
1003e4f7ee Use relative import for _imagingcms 2013-03-08 13:34:08 -08:00
Christoph Gohlke
aff6eccec5 Use relative import for _imaging 2013-03-08 13:30:41 -08:00
Christoph Gohlke
caba4e33ba Fix AttributeError: 'module' object has no attribute 'spawn' 2013-03-08 11:15:28 -08:00
Alex Clark
b03abf2e58 Merge branch 'master' of https://github.com/etienned/Pillow into etienned-master 2013-03-08 08:36:53 -05:00
Alex Clark
0c18a8f3b8 Use bytes literal, fixes Tests/test_file_fli.py 2013-03-08 08:01:56 -05:00
Alex Clark
b29326b175 Fix KeyError in Tests/test_file_xpm.py 2013-03-07 15:20:52 -05:00
Alex Clark
3020c16eaa Fix imports 2013-03-07 11:20:28 -05:00
Alex Clark
f29950bc6d Fix typo 2013-03-07 08:52:44 -05:00
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
etienne
55f2dc7b0b Added quantization tables and subsampling options to the JPEG encoder. 2013-03-06 20:23:02 -05: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
Brian Crowell
eed042fae5 py3k: __nonzero__ is now __bool__ 2013-01-10 08:46:44 -06:00
Brian Crowell
3a665a7835 py3k: Add true Unicode support to OleFileIO
The day has arrived when Python provides an official way to handle Unicode
strings.
2013-01-10 08:46:44 -06:00
Brian Crowell
fc035814bd py3k: map and filter to list comprehensions
What's really going on is that map() and filter() return iterators in py3k.
I've just gone ahead and turned them all into list comprehensions, because
I find them much easier to read.
2013-01-10 08:46:43 -06:00
Brian Crowell
e514912378 py3k: Rewrite dictionary support for Tiff ImageFileDictionary
This commit brings in the collections.MutableMapping mixin to provide full
dictionary support for ImageFileDictionary.
2013-01-10 08:46:43 -06:00
Brian Crowell
09f1081c95 py3k: Fix up uses of dictionary views, ranges, and has_key()
y.has_key(x) is gone (use x in y), and keys(), values(), items(), and
range() all return views.

Some iterables needed to be packed into lists, either because the code
expected a list (such as "range(256) * 3") or because the original
collection was being modified (automatic global declarations).

The Tiff ImageFileDictionary is a special case and will be dealt with in
another commit.
2013-01-10 08:46:42 -06:00
Brian Crowell
b386ed14dd py3k: Remove callable() function
callable(c) is isinstance(x, collections.Callable) in py3k.
2013-01-10 08:46:41 -06:00
Brian Crowell
197885164b py3k: Backport Gohlke's tests to run on 2.6/2.7
Most of the differences are in tobytes/tostring naming and expected
behavior of the bytes() constructor. The latter was usually easy to fix
with the right bytes literal.

This is a good preview of what will have to happen in the Python 3 code.
2013-01-10 08:46:39 -06:00
Brian Crowell
af5228896a py3k: Add module initialization and unicode/bytes int/long thunks
This commit:

* Adds Python 3 module initialization functions. I split out the main init
  of each module into a static setup_module function.
* Adds a py3.h which unifies int/long in Python 3 and unicode/bytes in
  Python 2. _imagingft.c unfortunately looks a little kludgy after this
  because it was already using PyUnicode functions, and I had to mix and
  match there manually.

With this commit, the modules all build successfully under Python 3.

What this commit does NOT do is patch all of the uses of PyArg_ParseTuple
and Py_BuildValue, which all need to be checked for proper use of bytes
and unicode codes. It also does not let selftest.py run yet, because there
are probably hundreds of issues to fix in the Python code itself.
2013-01-10 08:46:37 -06:00
Brian Crowell
78575798d7 py3k: Update exception usage to modern syntax 2013-01-10 08:46:33 -06:00
Brian Crowell
37f22ebfcd py3k: Use string methods instead of string module
First, we go for the obvious stuff. The string module methods are gone in
3.0, so we translate them to the appropriate methods on the string class.
2013-01-10 08:42:49 -06:00
cgohlke
11a859e7d3 Make FLI image detection more stringent 2012-12-20 21:47:45 -08:00
Manuel Ebert
4e397a4d1c Radius was hardcoded to 2.
This will probably, some time in the future get fixed upstream in PIL. Maybe.
2012-12-06 16:19:55 -08:00
Tom Payne
e414c66070 Add Image.alpha_composite 2012-12-04 16:44:26 +01:00
tdesvenain
3eda40cb4c revert last commit, images rendered didn't match very well 2012-07-29 17:05:54 +02:00
tdesvenain
bc9455d059 Added a psd mode (mode 4, 16 bits). 2012-07-29 16:02:26 +02:00
tdesvenain
4ebe7fc459 Fix opening psd files with RGBA layers when A mode is not of type 65535
but 3.
Fixes issue https://github.com/python-imaging/Pillow/issues/3
2012-07-29 15:48:40 +02:00
Corey Richardson
f466def82d Better import of _imaging 2012-06-15 17:39:51 -03:00
Tom Gross
33e1ffe570 fixed reading of EPS pictures
found in: http://www.mail-archive.com/image-sig@python.org/msg03054.html
2012-04-26 17:00:22 +02:00
Simon Law
5355fea83e Backport fix to split() after open() (regression in 1.1.7).
https://bitbucket.org/effbot/pil-2009-raclette/changeset/fb7ce579f5f9
2012-01-19 15:07:18 -05:00
Stéphane Klein
c144108396 Fix : resize need int values, append int conversion in thumbnail method 2011-07-20 15:49:37 +02:00
Alex Clark
9a640e3157 Forking PIL 2010-07-30 22:52:47 -04:00