Commit Graph

116 Commits

Author SHA1 Message Date
wiredfool
4596df45c1 Versioned interface for TiffTags 2015-09-13 15:15:13 +01:00
wiredfool
ca24a44100 Rewrap intelligently 2015-09-13 14:16:12 +01:00
wiredfool
e1236d702d v1/v2 tag storage in IFD, legacy_api as a parameter to _saveitem, save both _tags_v* when saving as legacy api 2015-09-13 14:01:01 +01:00
wiredfool
a9396ab412 convert load_* functions to pure functions with no state 2015-09-13 11:07:43 +01:00
wiredfool
156972874d missed a set of _v2 versioning 2015-09-13 10:53:47 +01:00
wiredfool
b1fdff4034 In a twisty maze of bytes, text and arbitrary metadata, py2 and py3. New IFD is putting textdata in type7 metadata and returning bytes, old one put it in type 2 string and returned a string. This may be an issue 2015-09-11 23:44:23 +01:00
wiredfool
5f9fff0215 Restoring bad exif handling 2015-09-11 22:39:37 +01:00
wiredfool
47a963c2a4 Legacy/versioned interface 2015-09-11 22:39:37 +01:00
wiredfool
9bb4c51629 module level default api level 2015-09-11 22:39:37 +01:00
wiredfool
0c942911d9 fixed the rebase 2015-09-11 22:39:37 +01:00
Antony Lee
1b9b3749ca Reorder OPEN_INFO to cover both endiannesses.
By interleaving little and big-endian entries we make sure entries
exist for both cases.  Some additional entries created when the
big-endian was missing.  I am not sure of what entry to create for the
big-endian, 4-bit case (what is the order of the two entries within the
byte?).
2015-09-11 22:39:37 +01:00
Antony Lee
6309bfe921 Support too long ExtraSamples.
Some programs generate SamplesPerPixel entries in ExtraSamples instead
of SamplesPerPixel-3, cf. #1227.  This is a stopgap measure to support
them.  One could also decide to add generic code to always support
having SamplesPerPixel entries (by dropping the first 3).
2015-09-11 22:39:37 +01:00
Antony Lee
93abbd0caa Restore legacy TIFF API.
To have the old API that always returns tuples, and fractions as pairs,
set the `legacy_api` attribute of the IFD to True.

This should alleviate concerns about backwards compatibility.
2015-09-11 22:39:37 +01:00
Antony Lee
d5b46dce96 Fix MPO support, and Python2.6 support. 2015-09-11 22:34:50 +01:00
Antony Lee
56a3f0f2ab Fix EXIF support. 2015-09-11 22:34:50 +01:00
Antony Lee
974bcc074b Major rewrite of TIFF ImageFileDirectory.
Do not represent scalar tags as 1-element tuples.  Keep tag
type and count information in TiffTags.TAGS.  Normalize data in
ImageFileDirectory.__setitem__: wrap and unwrap tuples as needed,
convert rationals to floats.  (To ensure consistency, make the "tags"
attribute private.)  Interpret byte data as a series of integers rather
than a bytearray (which should only map to the "undefined" type).  On
Python3, if a str is assigned to an "undefined" tag, encode it as ASCII.

Note that a large number of tags have been removed from TiffTags.TAGS
because I do not have time to figure out the type and count of each of
them.  They should be restored before this gets merged in.

This obviously breaks backwards compatibility in a lot of ways...
2015-09-11 22:34:50 +01:00
Antony Lee
aba7a34036 Fix setting of TIFF ExtraSamples tag.
- force cast ExtraSamples to a list.
- fix calls to ImagingLibTiffSetField to include array length.
2015-09-11 22:26:54 +01:00
Andrew Murray
105e963505 Flake8 fixes 2015-09-11 19:28:19 +10:00
Bogdan Kubala
42b5a85cb4 Fix for UnicodeDecodeError in TiffImagePlugin
Fix for UnicodeDecodeError: ascii codec cannot decode byte while saving a TIFF image

Problem occured while saving TIFF images that contain non-ascii characters in metadata

Manually merged with master by wiredfool
2015-09-10 07:57:47 -07:00
Andrew Murray
95fa2cdf08 Health fix 2015-08-28 18:56:48 +10:00
Andrew Murray
c6b13d294f Flake8 fixes 2015-08-25 22:27:18 +10:00
Andrew Murray
fa73879d19 Changed register calls to use format property 2015-07-04 23:29:58 +10:00
Alex Clark
67d1541c6f Merge pull request #1207 from anntzer/logger
Use logging instead of print.
2015-07-02 05:22:07 -04:00
Andrew Murray
d20eef450b Added is_animated 2015-06-30 13:25:00 +10:00
Antony Lee
4e754e9c55 Use logging instead of print.
cf. #1191.

Only TiffImagePlugin and OLEFileIO still rely on (their own) DEBUG flag.
I left TiffImagePlugin as it is because I hope #1059 gets merged in
first, and OLEFileIO because it uses its own logic.

Untested, as usual.
2015-06-29 12:39:50 -07:00
Andrew Murray
46fad0fd63 Fixed typo 2015-06-28 12:03:11 +10:00
Antony Lee
51f3560dc4 Restore negative seeks for TIFF. 2015-06-08 00:40:23 +10:00
Antony Lee
1b80fe5507 Provide n_frames attribute to multi-frame formats.
cf #1190, #1192.  Tests missing.
2015-06-08 00:40:23 +10:00
Andrew Murray
ed2cca1e71 Fixed Tiff handling of bad EXIF data 2015-06-07 00:09:54 +10:00
Andrew Murray
a996033079 Fixed various typos 2015-05-29 14:59:54 +10:00
Andrew Murray
9794aafc37 Removed or commented unused variables 2015-04-24 16:02:38 +10:00
Andrew Murray
ebc6996ba5 Changed list comprehension variable name to avoid redefinition 2015-04-24 16:00:08 +10:00
Andrew Murray
d1c182cadc Various Flake8 fixes 2015-04-24 09:26:52 +10:00
Björn Pedersen
61fb1c5bd4 Tiff: allow writing floating poitn tag values
Use the inverse logic used for loading floating point tag
values to also write them out again.
2015-02-23 09:46:35 +01:00
Antony Lee
800480db52 Use underscores, not spaces, in TIFF tag kwargs.
kwargs with spaces ("x resolution", "y resolution", "resolution unit"
and "date time") are deprecated.
2014-12-09 15:17:33 -08:00
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