Commit Graph

181 Commits

Author SHA1 Message Date
wiredfool
9a2cc7df83 hoist import, move test to libtiff 2014-11-15 20:38:52 -08:00
Martin Fergie
dd3a46520c Fix for saving to io.BytesIO() 2014-11-14 12:29:10 +00:00
Hugo
4d74b81a15 Merge pull request #980 from wiredfool/pr_938
4 bit TIFF support
2014-10-29 21:41:17 +02:00
hugovk
0df43e4f93 Avoid divide by zero 2014-10-25 23:42:02 +03:00
wiredfool
4f9b2dbe69 Fix pypy 2.4 regression, #952 2014-10-13 11:12:14 -07:00
Hugo
8cb5688047 flake8 2014-10-02 10:45:41 +03:00
Hugo
552a9a28a0 Support and test for 4-bit greyscale TIFF 2014-10-02 10:43:22 +03:00
wiredfool
17ac15543d fp.tell resyncs the python3 with the file pointer 2014-09-02 15:20:25 -07:00
wiredfool
d8b2829f4b Partial fix for test failures, works on py2.x 2014-09-02 15:20:25 -07:00
Kenny Ostrom
d5b4f136c5 added ifd offset to the tiff decoder args, call TIFFSetSubDirectory 2014-09-02 15:20:25 -07:00
wiredfool
99f7dd2aff Allocate a new core image object for each frame, fixes problems with reusing palettes and image sizes 2014-09-02 15:20:25 -07:00
wiredfool
9f04c2d0a5 Don't close fd for multipage files 2014-09-02 15:20:24 -07:00
hugovk
56404f6888 Change wrapping to include some context on first line; plus typo fix 2014-07-29 23:00:38 +03:00
hugovk
70528dd539 flake8 2014-07-28 19:00:06 +03:00
wiredfool
618a79c1c6 Merge from master, pre-unittest conversion 2014-06-03 14:42:22 -07:00
hugovk
c9a4272af6 Replace python-imaging with python-pillow (but yet not Coveralls) 2014-06-03 13:02:44 +03:00
wiredfool
edd75ceb91 Use libtiff for writing any compressed tiff files, Fixes #659, #431 2014-05-20 10:15:01 -07:00
wiredfool
54173d2c67 Cherry-pick of portions of patch a500ca1393, many shortcut ops added, no functional changes 2014-05-09 21:36:15 -07:00
Hijackal
029a4a5079 Add specific 32-bit float tiff format
We regularly use this format to store 32bit floats and I would like to see it handled by clean Pillow installations without having to add it on every system I use.
2014-04-10 15:52:53 +02:00
wiredfool
937ae7790f Renamed variables from reused single letter confusing names to something halfway descriptive 2014-03-27 22:19:39 -07:00
wiredfool
9552d9bc66 close the fd, if possible. Fixes #526 2014-03-27 22:18:40 -07:00
François Boulogne
923018dfeb MAINT: s/while 1:/while True:/ 2014-01-07 21:21:24 -05:00
wiredfool
aa1c0fdfb6 merge from master 2013-12-19 20:48:49 -08:00
wiredfool
543f96de61 Merge from master 2013-11-30 09:57:00 -08:00
wiredfool
94e3c75179 Merge from 12-bit-tiff 2013-11-21 21:41:54 -08:00
wiredfool
44e4d6b49d Comments 2013-11-21 20:57:48 -08:00
wiredfool
16c95fc295 Flags to force libtiff read/write 2013-11-21 20:37:52 -08:00
wiredfool
65e3bfaf33 added generic libtiff en/decoder instead of each compression version 2013-11-21 20:37:52 -08:00
wiredfool
9d06fa74be 12 bit tiffs come out as 12 bits from libtiff 2013-11-21 20:37:30 -08:00
wiredfool
e4fe6ae7a3 Read only implementation of 12bit tiffs 2013-11-20 16:56:23 -08:00
wiredfool
49191c78fb CHECK: support for int arrays as ifd entries 2013-11-07 16:23:20 -08:00
wiredfool
d2f1fa0e5f two additional tags for saving color images with libtiff 2013-11-05 20:49:09 -08:00
cgohlke
42b8ec37d7 Support RGBA TIFF with missing ExtraSamples tag 2013-10-26 18:02:17 -07:00
wiredfool
63995459bc merge from master 2013-10-22 16:18:06 -07:00
wiredfool
f8abb98ffd Merge from master 2013-10-22 16:05:18 -07:00
wiredfool
6a0516d2c9 final pass through atts: handling single rational tuple, using isStringType, flattening from single element tuple to string or int 2013-10-22 10:10:37 -07:00
wiredfool
8655209b4a rm debugging print 2013-10-22 09:24:51 -07:00
wiredfool
32e2f97b21 Tag issues with libtiff -- Need to parse the tuples for the ifd and the im.ifd. getattr + default for the im.ifd instead of silent try/except 2013-10-22 09:18:41 -07:00
Eric Soroos
3128a76495 MM and II 16 bit integer tiffs pack/write properly using libtiff on bigendian platform 2013-10-21 22:37:20 +00:00
Eric Soroos
6f8d968cbb MM and II 16 bit integer tiffs unpack properly using libtiff on bigendian platform 2013-10-21 22:17:33 +00:00
wiredfool
7ece94edc7 compression in encoder info 2013-10-21 09:30:06 -07:00
wiredfool
08347569b5 Another python 2.6 detail 2013-10-08 11:32:51 -07:00
wiredfool
e9b0b09b72 Python 2.6 compatibility 2013-10-08 10:43:55 -07:00
wiredfool
a91283061e Python3 fixes 2013-10-07 23:30:55 -07:00
wiredfool
e35ed87be6 Writing multiple rational items 2013-10-07 23:09:41 -07:00
wiredfool
0204733fd6 Proper handling of both IFDs for libtiff usage 2013-10-07 23:03:50 -07:00
wiredfool
2188cf2baf typo 2013-10-07 23:03:13 -07:00
wiredfool
e6c8e5abec better handling of unicode, rational tuples 2013-10-07 23:02:59 -07:00
wiredfool
951a5d4ce8 Using the public interface rather than the raw, undecoded interface 2013-10-07 17:05:27 -07:00
wiredfool
ce0e8b6abf streamlining internal representation of types in ImageFileDirectory 2013-10-07 17:05:27 -07:00
wiredfool
c4f9fa7a40 Py3 -- can't join a string 2013-10-02 22:23:27 -07:00
wiredfool
dbf47837ce Add arbitrary tags to tiff images using an ImageFileDirectory 2013-10-02 22:06:17 -07:00
wiredfool
bb9672095b initial working version of saving arbitrary tags from the img.tags directory 2013-09-28 21:31:32 -07:00
wiredfool
465ebd3af3 added tagnames for ImageJ tiff tags 2013-09-27 10:41:27 -07:00
wiredfool
a40950c3b9 Properly set the mode for files with rawmode of F;32BF 2013-09-27 10:41:03 -07:00
Eric Buehl
26fb0eadad issue warning instead of debug/print 2013-08-20 16:53:55 +00: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
wiredfool
db49dbf9de Ignore fillorder=2 when reading using libtiff 2013-07-10 22:36:55 -07:00
Alexey Buzanov
a130c45990 add several TIFF decoders and encoders 2013-07-01 18:45:42 +04: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
1540d46ca9 support for the differences between StringIO and BytesIO 2013-03-14 10:36:15 -07:00
Christoph Gohlke
dbfaff5673 Support uint32 TIFF 2013-03-13 21:08:24 -07:00
Christoph Gohlke
a26d7b6261 Decode bytestr instead of str 2013-03-13 19:18:40 -07:00
wiredfool
a3b4697965 typo 2013-03-11 22:04:34 -07: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
3020c16eaa Fix imports 2013-03-07 11:20:28 -05:00
Alex Clark
f29950bc6d Fix typo 2013-03-07 08:52:44 -05:00
Phil Elson
603f2a226f Added the `named` method to a Tiffs tag getter. 2013-03-07 12:00:19 +00:00
Mikhail Korobov
a71183dab5 better fix for #15 (with a test case now) 2013-02-26 17:12:11 +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
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
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
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
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
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
Alex Clark
9a640e3157 Forking PIL 2010-07-30 22:52:47 -04:00