Commit Graph

2507 Commits

Author SHA1 Message Date
Andrew Murray
d96f657328
Merge pull request #3998 from chadawagner/master
Fix bug in TIFF loading of BufferedReader
2019-08-23 06:25:30 +10:00
chadawagner
34330a7aa0
Update Tests/test_file_libtiff.py
Co-Authored-By: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2019-08-19 09:46:07 -07:00
Andrew Murray
f08a0966a0 Corrected tag counts 2019-08-19 21:12:16 +10:00
Andrew Murray
5b120164b5 Corrected underline [ci skip] 2019-08-17 20:32:24 +10:00
nulano
fa6b80fddf add option to capture all monitors on Windows 2019-08-15 20:03:33 +10:00
chadawagner
457a97dde8 added test for reading TIFF from non-disk file obj 2019-08-12 18:56:34 +10:00
djy0
0872cb4377 fix comment 2019-08-12 18:54:29 +10:00
djy0
63c15dc3ba format 2019-08-12 18:54:29 +10:00
djy0
3c971bec41 format 2019-08-12 18:54:29 +10:00
djy0
8696f06fbe Update test_file_gif.py 2019-08-12 18:54:29 +10:00
Andrew Murray
23872c0645 Do not allow floodfill to extend into negative coordinates 2019-08-12 06:51:16 +10:00
Andrew Murray
8fff9a2444 Fixed arc drawing bug for a non-whole number of degrees 2019-08-12 06:50:58 +10:00
Andrew Murray
27d6fc7bc5 Improved HSV conversion 2019-08-12 06:50:18 +10:00
Andrew Murray
f93a5d0972 Added text stroking 2019-07-29 06:40:03 +10:00
Andrew Murray
66ad3cb461 Changed overflow check to use PY_SSIZE_T_MAX 2019-07-17 07:07:26 +10:00
Hugo van Kemenade
1ab5670eb1
Introduce isort to automate import ordering and formatting (#3954)
Introduce isort to automate import ordering and formatting
2019-07-16 23:02:31 +03:00
Andrew Murray
2995fb67c1 Return after error 2019-07-13 13:50:13 +10:00
Andrew Murray
023dcf27c2 Raise the same error if a truncated image is loaded a second time 2019-07-13 08:37:17 +10:00
Jon Dufresne
d50445ff30 Introduce isort to automate import ordering and formatting
Similar to the recent adoption of Black. isort is a Python utility to
sort imports alphabetically and automatically separate into sections. By
using isort, contributors can quickly and automatically conform to the
projects style without thinking. Just let the tool do it.

Uses the configuration recommended by the Black to avoid conflicts of
style.

Rewrite TestImageQt.test_deprecated to no rely on import order.
2019-07-06 16:11:35 -07:00
nulano
0b0dc1112e Merge branch 'master' into revert-3931-update-freetype-epsilon
# Conflicts:
#	Tests/test_imagefont.py
2019-07-02 22:49:45 +02:00
nulano
d7c69ea2b4 skip test_unicode_extended on Python 2.x 2019-07-02 11:14:09 +02:00
nulano
22ce5cc0c7
Revert "Update epsilon for FreeType 2.10 with eg. Unicode width 16" 2019-07-02 11:08:48 +02:00
nulano
14ddfd30b2 fix lint 2019-07-02 09:31:05 +02:00
nulano
86d4c53d79 revert #3780 for PyPy as it hasn't been updated 2019-07-02 08:52:15 +02:00
Hugo
46535df8f3 Update epsilon for FreeType 2.10 with eg. Unicode width 16 2019-07-01 16:32:22 +03:00
Oliver Tonnhofer
edeb8d69af
Merge branch 'master' into tiff-jpeg-quality 2019-07-01 11:00:06 +02:00
Oliver Tonnhofer
2af4026201 Improve encoding of TIFF tags (#3861)
* Improve encoding of TIFF tags

- Pass tagtype from v2 directory to libtiff encoder, instead of
autodetecting type.
- Use explicit types. E.g. uint32_t for TIFF_LONG to fix issues on
platforms with 64bit longs.
- Add support for multiple values (arrays). Requires type in v2
directory and values must be passed as a tuple.
- Add support for signed types (e.g. TIFFTypes.TIFF_SIGNED_SHORT).

Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2019-06-30 21:48:19 +03:00
Hugo
8d4bb339a6
Merge pull request #3780 from nulano/update_py_unicode
Update Py_UNICODE to Py_UCS4
2019-06-30 13:21:46 +03:00
Hugo
12695b8ca3
Merge pull request #3899 from radarhere/pixelsize
Consider I;16 pixel size when drawing
2019-06-30 13:18:46 +03:00
Hugo
f5a89a0e9a Use unittest asserts for consistency 2019-06-30 11:13:02 +03:00
Andrew Murray
c994b783ec
Merge branch 'master' into tiff-jpeg-quality 2019-06-30 14:03:09 +10:00
Andrew Murray
42588a6493 Skip test if libtiff is not installed 2019-06-30 13:26:58 +10:00
Andrew Murray
cc0d70145b Lint fixes 2019-06-30 13:26:58 +10:00
Christoph Gohlke
4a69223db9 Add test for sampleformat corruption 2019-06-30 13:26:58 +10:00
Andrew Murray
9074eda608
Merge pull request #3778 from radarhere/all_frames
Added ImageSequence all_frames
2019-06-30 07:55:34 +10:00
Andrew Murray
90d3d37164 Do not presume that the background color index is 0 2019-06-29 23:06:45 +10:00
Andrew Murray
97c15a245c Corrected color table size calculation 2019-06-29 23:02:26 +10:00
Andrew Murray
c3e982e0c6
Merge branch 'master' into master 2019-06-29 22:59:17 +10:00
Hugo
0e7358a046
Updated TIFF tile descriptors to match current decoding functio… (#3795)
Updated TIFF tile descriptors to match current decoding functionality
2019-06-29 10:27:00 +03:00
Hugo
08c47925d0
Added an image.entropy() method (#3608)
Added an `image.entropy()` method
2019-06-29 10:12:34 +03:00
Hugo
372c7c352a
Merge pull request #3703 from jkrshnmenon/master
Add an upper limit for blocks_max in _set_blocks_max
2019-06-27 23:03:25 +03:00
Hugo
b584635a8c
Merge pull request #3912 from radarhere/non_font_bytes
Fixed crash when loading non-font bytes
2019-06-27 22:40:29 +03:00
Andrew Murray
8b447c4840 Lint fixes 2019-06-26 19:16:36 +10:00
Alexander Böhn
7b815a5f1d Added an image.entropy() method
This calculates the entropy for the image, based on the histogram.

Because this uses image histogram data directly, the existing C
function underpinning the `image.histogram()` method was abstracted
into a static function to parse extrema tuple arguments, and a new
C function was added to calculate image entropy, making use of the
new static extrema function.

The extrema-parsing function was written by @homm, based on the
macro abstraction I wrote, during the discussion of my first
entropy-method pull request: https://git.io/fhodS

The new `image.entropy()` method is based on `image.histogram()`,
and will accept the same arguments to calculate the histogram data
it will use to assess the entropy of the image.

The algorithm and methodology is based on existing Python code:

* https://git.io/fhmIU

... A test case in the `Tests/` directory, and doctest lines in
`selftest.py`, have both been added and checked.

Changes proposed in this pull request:

* Added “math.h” include to _imaging.c
* The addition of an `image.entropy()` method to the `Image`
  Python class,
* The abstraction of the extrema-parsing logic of of the C
  function `_histogram` into a static function, and
* The use of that static function in both the `_histogram` and
  `_entropy` C functions.
* Minor documentation addenda in the docstrings for both the
  `image.entropy()` and `image.histogram()` methods were also
  added.
* Removed outdated boilerplate from testing code
* Removed unused “unittest” import
2019-06-26 19:15:47 +10:00
Andrew Murray
f22198e3bc Lint fixes 2019-06-26 19:09:02 +10:00
Andrew Murray
d591cf8d3f Error is not raised on 64-bit systems 2019-06-26 19:08:07 +10:00
Jayakrishna Menon
590b5b7f9e test case for set_blocks_max 2019-06-26 19:08:07 +10:00
Jayakrishna Menon
2acc098cab adding testcase for overflow 2019-06-26 19:08:07 +10:00
Jayakrishna Menon
494fb25bdb adding testcase for overflow 2019-06-26 19:08:07 +10:00
Oliver Tonnhofer
2b7d8be536 tiff: add support for JPEG quality
Uses JPEGQUALITY pseudo-tag from libtiff.

Also changes the way tags are passed to PyImaging_LibTiffEncoderNew from
dict to list to ensure that COMPRESSION tag is added before JPEGQUALITY.
This is required as the COMPRESSION tag registers the JPEGQUALITY
pseudo-tag.
2019-06-26 06:33:54 +10:00
Oliver Tonnhofer
61add9d6b0 Improve encoding of TIFF tags
- Pass tagtype from v2 directory to libtiff encoder, instead of
autodetecting type.
- Use explicit types. E.g. uint32_t for TIFF_LONG to fix issues on
platforms with 64bit longs.
- Add support for multiple values (arrays). Requires type in v2
directory and values must be passed as a tuple.
- Add support for signed types (e.g. TIFFTypes.TIFF_SIGNED_SHORT).
2019-06-26 06:33:19 +10:00
Andrew Murray
25cf1010eb Lint fixes 2019-06-25 22:20:57 +10:00
nulano
983371d4d8 fix centos, amazon 2019-06-25 22:16:00 +10:00
nulano
be192d8f69 fix lint 2019-06-25 22:16:00 +10:00
nulano
5f65f10191 add test for #3777 2019-06-25 22:16:00 +10:00
Andrew Murray
d00e18b017 Updated test result 2019-06-23 14:01:51 +10:00
David Nisson
ddb61cfbd2 updated tests to match new tile descriptors 2019-06-23 13:59:20 +10:00
Andrew Murray
9c37933bb9 Added CMYK;16B and CMYK;16N unpackers 2019-06-23 11:56:17 +10:00
Andrew Murray
7bb16de81c Fixed crash when loading non-font bytes 2019-06-23 11:53:01 +10:00
Andrew Murray
db4916849e Added ImageSequence all_frames 2019-06-23 07:34:39 +10:00
Andrew Murray
e0cbfb2708 Consider I;16 pixel size when drawing 2019-06-23 07:33:55 +10:00
Andrew Murray
68fac40147 Fixed black formatting 2019-06-22 14:47:56 +10:00
Hugo
f5cd8b4b0d
Merge pull request #3909 from hugovk/run-black
Format code with Black
2019-06-22 06:46:15 +03:00
Andrew Murray
ea0f1c6b06 Do not presume that the last glyph has the max x value 2019-06-19 22:32:01 +10:00
Andrew Murray
fb38296230 Change direction of y offset in calculating size 2019-06-19 22:30:50 +10:00
Hugo
be1b551bfc
Add __main__.py to output basic format and support information (#3870)
Add __main__.py to output basic format and support information
2019-06-19 14:42:34 +03:00
Andrew Murray
da16b7ec45 Added variation font support 2019-06-19 20:27:49 +10:00
Hugo
488a0170a3 Format with Black 2019-06-19 09:30:10 +03:00
Hugo
1b99362f3d Merge remote-tracking branch 'upstream/master' into run-black 2019-06-19 09:29:28 +03:00
Hugo
f338eae128
Merge pull request #3869 from radarhere/imageshow
Do not down-convert if image is LA when showing with PNG format
2019-06-19 09:26:15 +03:00
Hugo
a9c05c7aa0
Merge pull request #3759 from radarhere/psd_frames
Improve handling of PSD frames
2019-06-19 09:15:13 +03:00
Hugo
ac6185ca15
Merge pull request #3897 from radarhere/load
Improved ICO and ICNS loading
2019-06-19 09:09:34 +03:00
Hugo
b2714854a3
Merge pull request #3856 from radarhere/ttb
Corrected ttb text positioning
2019-06-19 09:01:51 +03:00
Hugo
5631718a8d Format with Black 2019-06-13 18:54:46 +03:00
Hugo
77f946d8bc Format with Black 2019-06-13 18:54:24 +03:00
Hugo
f87821e010 Format with Black 2019-06-13 18:54:11 +03:00
Hugo
d08475442b Format with Black 2019-06-13 18:53:42 +03:00
Andrew Murray
b262378632 Added mode descriptors for all I;16 modes 2019-06-12 20:33:00 +10:00
Andrew Murray
e8af68bae2 Increased test coverage 2019-06-12 20:30:43 +10:00
Andrew Murray
e1e35cc819 Close internal fp when closing and deleting 2019-06-12 20:12:03 +10:00
Andrew Murray
ea02e28adb Use _min_frame in ImageSequence.Iterator 2019-06-12 20:11:51 +10:00
Andrew Murray
72d5ee3bfa Do not close exclusive fp after loading 2019-06-12 20:10:28 +10:00
Andrew Murray
f7d7a80b5b Allow ICNS to change size as ICO does 2019-06-12 02:19:58 +10:00
Andrew Murray
02a2e93703 Do not load ICO if already loaded 2019-06-12 02:18:54 +10:00
Andrew Murray
231fe4d62a Revert "Merge pull request #3838 from radarhere/i_conversion"
This reverts commit 41f3e7c8bd, reversing
changes made to 2f84482871.
2019-06-11 19:28:31 +10:00
Andrew Murray
54c83f61bd Check for raqm version function 2019-06-07 05:51:40 +10:00
Andrew Murray
1c1447f563 Corrected ttb text positioning 2019-06-07 05:51:40 +10:00
Andrew Murray
77630f000c Updated resampling filter error messages 2019-06-06 21:36:38 +10:00
Hugo
169961649d
Merge pull request #3848 from radarhere/pa
Improved palette handling for LA and PA modes
2019-06-05 22:32:44 +03:00
Hugo
41f3e7c8bd
Merge pull request #3838 from radarhere/i_conversion
Improved I mode conversion
2019-06-05 22:23:35 +03:00
Andrew Murray
e011fb155f Fixed typo 2019-06-05 19:32:50 +10:00
Hugo
23d4e6f4c4 Tighten fixed pyroma test 2019-06-02 22:36:05 +03:00
Jon Dufresne
1008644dd6 Add __main__.py to output basic format and support information
To help debug and show supported formats, users can run:

    $ python -m PIL

to get basic format and support information about the installed version
of Pillow.

The new feature works as follows:

    $ python -m PIL
    --------------------------------------------------------------------
    Pillow 6.1.0.dev0
    --------------------------------------------------------------------
    Python modules loaded from .../Pillow/src/PIL
    Binary modules loaded from .../Pillow/src/PIL
    --------------------------------------------------------------------
    Python 3.7.3 (default, May 11 2019, 00:38:04)
           [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
    --------------------------------------------------------------------
    --- PIL CORE support ok
    --- TKINTER support ok
    --- FREETYPE2 support ok
    --- LITTLECMS2 support ok
    --- WEBP support ok
    --- WEBP Transparency support ok
    --- WEBPMUX support ok
    --- WEBP Animation support ok
    --- JPEG support ok
    --- OPENJPEG (JPEG2000) support ok
    --- ZLIB (PNG/ZIP) support ok
    --- LIBTIFF support ok
    --- RAQM (Bidirectional Text) support ok
    --------------------------------------------------------------------
    BLP
    Extensions: .blp
    Features: open
    --------------------------------------------------------------------
    BMP image/bmp
    Extensions: .bmp
    Features: open, save
    --------------------------------------------------------------------
    BUFR
    Extensions: .bufr
    Features: open, save
    --------------------------------------------------------------------
    …
2019-05-27 18:44:04 -07:00
Hugo
feb413e0f3
Merge pull request #3836 from radarhere/ico_size
Handle unexpected ICO image sizes
2019-05-12 19:53:48 +03:00
Andrew Murray
d830cca5ca Handle unexpected ICO image sizes 2019-05-12 20:44:29 +10:00
Andrew Murray
e131fa22e2 Fixed reading and saving for TIFF and IM in PA mode 2019-05-11 14:43:48 +10:00
Andrew Murray
e9c0cf61f3 Fixed palette for LA and PA mode when pickling 2019-05-11 14:43:00 +10:00
Konstantin Kopachev
5e5ff10f09 Fix bits value for RGB;16N unpackers 2019-05-10 08:07:01 +10:00
Andrew Murray
2787b9b991 Added tests 2019-05-08 21:59:16 +10:00
Andrew Murray
ddc83fd8a7 Updated ImageMath tests for scaled I mode conversion 2019-05-08 21:58:50 +10:00