Commit Graph

105 Commits

Author SHA1 Message Date
Alexander
4d56db3a34 Fix wrong formula for subsampling=2 while JPEG saving 2017-08-27 20:03:36 +03:00
Vytis Banaitis
7c8e0e4457 Fix ZeroDivisionError when EXIF contains invalid DPI (0/0). 2017-08-09 16:16:14 +03:00
wiredfool
7a8161162f fix for https://github.com/python-pillow/Pillow/issues/2628#issuecomment-315962612 2017-07-18 00:54:11 -07:00
Fran Barba
ebaa509d66 Adjust buffer size when icc_profile > MAXBLOCK (issue #148)
We were encountering some errors when saving specific JPEG images.
The error was shown in stderr as:
  IOError: encoder error -2 when writing image file

And on stdout it printed:
    Suspension not allowed here

The problem was the bufsize not contemplating the icc_profile block.
2017-06-28 12:11:33 +02:00
hugovk
c70eb8a128 flake8 2017-05-27 23:55:14 +03:00
hugovk
e4d6223c94 Remove deprecated code due for removal in Pillow 4.2 (per PR #2010) 2017-05-27 23:20:03 +03:00
Hugo
8b06fa9a21 Fix for file with DPI in EXIF but not metadata, and XResolution is an int rather than tuple 2017-04-11 14:07:31 +03:00
Hugo
53df62647a DPI is a tuple (#2472)
* DPI is a tuple

* Some EXIF only contains an X resolution for DPI

* Refactor

* Test with no DPI in EXIF

* Handle EXIF with no DPI

* Created with: exiftool "-*resolution*"= photoshop-200dpi.jpg

* Test when not in EXIF, DPI==72,72

* Use X resolution for Y, default to 72,72 dpi

* Created with: exiftool -exif:ResolutionUnit=cm photoshop-200dpi.jpg

* Test for EXIF with dpcm instead of dpi

* Convert dpcm to dpi, and default to inches if unit unknown
2017-04-03 23:28:33 +01:00
Hugo
07a9620959 If DPI isn't in JPEG header, fetch from EXIF 2017-03-14 11:49:10 +02:00
Andrew Murray
798fde57ca Removed unused imports 2017-03-03 21:38:19 +11:00
Andrew Murray
58b5c9187d Replaced absolute PIL imports with relative imports (#2349) 2017-01-17 13:22:18 +00:00
Jerome Leclanche
3ac9ab6fa2 Remove an unnecessary import 2017-01-07 08:12:33 +11:00
wiredfool
55f7a736a4 Merge pull request #2234 from radarhere/print
Updated comments to use print as a function
2016-12-13 20:00:25 +00:00
wiredfool
7e2bd28a7c Fix for issue 2272, CMYK images miss the heuristic for the maxblock buffer scaling 2016-12-03 14:45:45 +00:00
Andrew Murray
67be3a9eda Added future print_function imports 2016-11-26 11:05:56 +11:00
Andrew Murray
4ed31e8ef7 Updated comments to use print as a function 2016-11-26 11:02:44 +11:00
wiredfool
620d082457 Merge pull request #2240 from uploadcare/draft-min-scale
Use minimal scale for jpeg drafts
2016-11-22 15:22:59 +00:00
Jon Dufresne
dbe9f85c7d Drop support for Python 2.6
* Drop unittest2 requirement
* Use set literals
* Use dict/set comprehension
* Use str.format() automatic numbering
2016-11-22 04:23:55 -08:00
homm
55fca4857c protect .draft() from second call 2016-11-22 04:28:04 +03:00
homm
8f6b7b258b use minimal scale for jpeg downscaling 2016-11-22 04:00:49 +03:00
Jon Dufresne
ffa5bc2726 Use generator expressions instead of list comprehension
Avoids unnecessary temporary lists in memory.
2016-11-14 18:11:15 -08:00
wiredfool
1a43da7a8b Removed 'Debugging' open_ppm call that didn't check file provided parameters for sanity 2016-10-03 07:27:02 -07:00
Andrew Murray
d3d29ab2e3 Use truth value when checking for optimize option on save 2016-09-25 21:20:54 +10:00
Andrew Murray
de6158f5f1 Read value when checking for JPEG progressive key 2016-09-23 20:32:21 +10:00
Andrew Murray
051a410859 Convert DPI to ints when saving as JPEG 2016-09-22 19:41:32 +10:00
homm
193c756139 return implicit RGBA to JPEG save, raise warning 2016-08-09 03:11:35 +03:00
homm
c1da18e0ad do not allow to save images discarding alpha channel 2016-07-03 05:40:34 +03:00
Konstantin Kopachev
c8f93c979c
Skip extra 0xff00 in jpeg 2016-06-22 13:36:23 -07:00
Stephen Arthur
8b572ade81 Found edge cases with custom qtables
And there was a lingering bug since the previous qtable unsigned char fix
(#1814) since the call to array.array was in another place, the roundtrip was no
longer equivalent.

That was a minor change, but the revised test wouldn't pass because saving an image
with one custom qtable automatically adds a second to it by the call to
jpeg_set_defaults.
With 1 or >2 custom tables, there is extra work we have to do due to that call.
2016-05-22 17:54:31 -07:00
Andrew Murray
e51061dd59 Used isinstance instead of comparing types 2016-05-10 22:21:55 +10:00
Stephen Arthur
b38c32ed70 Valid range for baseline jpeg qtables 0 to 255, fixed issue from using signed char instead of unsigned char. added test 2016-04-06 18:47:51 -07:00
Andrew Murray
677b958a7f Health fixes 2016-04-01 21:49:30 +11:00
wiredfool
a6c1331fdd Rolling back exif support to pre-3.0 format 2016-01-01 04:14:24 -08:00
Hugo
c0b3fe77d7 Merge pull request #1621 from radarhere/health
Flake8 fixes
2015-12-31 15:18:31 +02:00
wiredfool
eba87ac6d9 Catch the IFD error near the source 2015-12-30 13:34:33 -08:00
Andrew Murray
a83bcec169 Flake8 fixes 2015-12-31 07:27:27 +11:00
wiredfool
33b90e9b6f rolling back gps exif support to match pre 3.0.0 results 2015-12-29 22:58:54 +00:00
Andrew Murray
0b64d6d8bf Removed unnecessary pass statement 2015-12-10 21:34:02 +11:00
Andrew Murray
e9a6a96053 Specified exception type 2015-12-02 16:23:49 +11:00
Andrew Murray
1306f7d6af Updated URLs for redirects 2015-09-28 21:53:25 +10:00
wiredfool
cae6a5f86c Merge pull request #1427 from radarhere/fix
Removed trailing whitespace
2015-09-20 10:48:06 +01:00
Andrew Murray
baac3c2321 Removed trailing whitespace 2015-09-15 21:37:51 +10:00
homm
9930b05a33 fix tiff exif loading in case when file is empty or ended 2015-09-15 04:06:51 +03:00
wiredfool
47a963c2a4 Legacy/versioned interface 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
Hugo van Kemenade
991829b75a Merge pull request #1414 from wiredfool/pr1360
Catch TypeError in _getexif
2015-09-10 19:11:32 +03:00
wiredfool
587698051f comments for future understanding 2015-09-10 04:36:07 -07:00
wiredfool
c614846fb7 Extend the fix to the other exif seek 2015-09-10 04:19:25 -07:00
homm
0b19a86087 skip any number extraneous chars at the end of chunks 2015-09-08 18:05:37 +03:00