Commit Graph

133 Commits

Author SHA1 Message Date
Hugo
74d2767c57 Remove duplicate line 2019-10-07 14:30:59 +03:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03:00
Hugo
af770a6c55 Drop support for EOL Python 2.7 2019-10-07 14:30:59 +03:00
Andrew Murray
fb8470187a
Merge pull request #4034 from cgohlke/patch-1
Initialize rows_per_strip when RowsPerStrip tag is missing
2019-09-30 22:32:34 +10:00
Andrew Murray
4de10089f0 Moved libtiff test into libtiff test file 2019-09-29 21:06:11 +10:00
Hugo van Kemenade
f5aed1a254
Merge branch 'master' into patch-1 2019-09-20 22:59:29 +03:00
Andrew Murray
19ab3c36e6 Added test 2019-09-18 22:07:17 +10:00
Andrew Murray
1b70a4c6b5 Use TIFF orientation 2019-09-13 22:36:26 +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
chadawagner
457a97dde8 added test for reading TIFF from non-disk file obj 2019-08-12 18:56:34 +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
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
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
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
Hugo
f87821e010 Format with Black 2019-06-13 18:54:11 +03:00
Konstantin Kopachev
5e5ff10f09 Fix bits value for RGB;16N unpackers 2019-05-10 08:07:01 +10:00
Andrew Murray
ca0d28eae5 Added reading of CMYK;16L TIFF images 2019-05-01 00:42:30 +10:00
Konstantin Kopachev
28c6f555a2
Merge remote-tracking branch 'remotes/upstream/master' into tiff-old-jpeg 2019-03-11 10:38:02 -07:00
Andrew Murray
dd0e4ac0a1 Corrected length of Tiff BYTE tags 2019-02-22 23:17:26 +11:00
Andrew Murray
b0f429adca
Line too long 2019-02-15 22:12:40 +11:00
Andrew Murray
6fc7460f9e
Restored newline at end of file 2019-02-15 20:47:00 +11:00
Andrew Murray
1a7a1123e6
Merge branch 'master' into tiff-old-jpeg 2019-02-15 19:56:17 +11:00
Jon Dufresne
4de5477b61 Remove unnecessary unittest.main() boilerplate from test files
With the introduction and use of pytest, it is simple and easy to
execute specific tests in isolation through documented command line
arguments. Either by specifying the module path or through the `-k
EXPRESSION` argument. There is no longer any need to provide the
boilerplate:

    if __name__ == '__main__':
        unittest.main()

To every test file. It is simply noise.

The pattern remains in test files that aren't named with `test_*` as
those files are not discovered and executed by pytest by default.
2019-02-03 10:10:16 -08:00
Hugo
1885a2cef5
Merge pull request #3579 from jdufresne/run-one-test
Improve pytest configuration to allow specific tests as CLI args
2019-02-03 11:30:57 +02:00
Hugo
187ba3f6e8 Flake8: Fix F723 syntax error in type comment 'dummy value'; it's just a comment, not a Mypy type 2019-01-30 11:53:26 +02:00
Jon Dufresne
7da17ad41e Improve pytest configuration to allow specific tests as CLI args
The previous test configuration made it difficult to run a single test
with the pytest CLI. There were two major issues:

- The Tests directory was not a package. It now includes a __init__.py
  file and imports from other tests modules are done with relative
  imports.

- setup.cfg always specified the Tests directory. So even if a specific
  test were specified as a CLI arg, this configuration would also always
  include all tests. This configuration has been removed to allow
  specifying a single test on the command line.

Contributors can now run specific tests with a single command such as:

  $ tox -e py37 -- Tests/test_file_pdf.py::TestFilePdf.test_rgb

This makes it easy and faster to iterate on a single test failure and is
very familiar to those that have previously used tox and pytest.

When running tox or pytest with no arguments, they still discover and
runs all tests in the Tests directory.
2019-01-13 09:00:12 -08:00
Jon Dufresne
3e28ba3b7d Python del is a statement not a function
https://docs.python.org/3/reference/simple_stmts.html#the-del-statement
2019-01-12 18:28:35 -08:00
Andrew Murray
6ead422e91 Added custom string TIFF tags 2018-12-29 16:14:52 +11:00
Konstantin Kopachev
e91b851fdc
Add reading old-JPEG compressed TIFFs
Old-style JPEG compression in TIFFs are able to be read using Strip/Tile APIs. Although, it should be possible to read them using Scanline API, it does not work for some reason.  Anyway, reading subsampled YCbCr formats through Strip/Tile/Scanline libtiff API does not de-subsample the data, so caller should unpack data to whatever format is appropriate.  New-style JPEG compressed images were already read through libtiff as RGB images (https://github.com/python-pillow/Pillow/pull/3227). Unfortunately, there is no flag to ask libtiff to de-subsample old jpeg, but it provides a way to read any image as 32bit RGBA.  This commit adds ability to read old-style JPEG TIFFs through reading *all* YCbCr images as RGBX using Tile and Strip reading API. This supersedes previous work (PR #3227) to read new-style JPEG-TIFFs.
2018-12-10 10:07:41 -08:00
Andrew Murray
ddf8593e7b Do not write custom tags with libtiff < 4 2018-11-12 06:14:04 +11:00
Andrew Murray
a3d45e9cef Added custom int and float TIFF tags 2018-11-12 06:14:04 +11:00
Hugo
a3b0659790 flake8 2018-10-24 22:29:01 +03:00
Hugo
d1ca4916e0 Use more specific assertions 2018-10-24 22:29:01 +03:00
Andrew Murray
c7d924fd85 Too many blank lines 2018-10-21 18:11:50 +11:00
Hugo
d36365f4fb
Merge pull request #3227 from kkopachev/master
Adding support to reading tiled and YcbCr jpeg tiffs through libtiff
2018-09-29 19:45:29 +03:00
Hugo
84b4905a94
Merge pull request #3310 from radarhere/compression
Fixed None as TIFF compression argument
2018-09-29 19:44:43 +03:00
Hugo
b9b4c03957
Merge pull request #2203 from jdufresne/test-exceptions
Avoid catching unexpected exceptions in tests
2018-09-26 15:43:41 +03:00
Konstantin Kopachev
b0e5e5fb11
Update test files to be closer match of originals 2018-09-18 12:05:51 -07:00
Konstantin Kopachev
52637a4268
move libtiff-related tests into libtiff test file 2018-09-18 12:05:50 -07:00
wiredfool
4cfcc3b010 Tests for issue #1765 2018-09-07 20:32:54 +10:00
Jon Dufresne
875e8c4bda Avoid catching unexpected exceptions in tests
Instead, allow exceptions to bubble up to the unittest exception
handler.

Prevents replacing the exception trace with a less informative
message. As the exceptions are always unexpected, should not need to
catch them explicitly in tests.
2018-09-04 19:43:20 -07:00
Andrew Murray
36b1afff26 Fixed None as TIFF compression argument 2018-08-25 08:21:43 +10:00
Andrew Murray
c2189235af Line too long 2018-07-02 19:26:02 +10:00
Andrew Murray
0e61d4be9f Removed unused variables 2018-07-02 19:21:44 +10:00
Andrew Murray
dcf6bc047b Do not use bare except 2018-07-02 19:21:44 +10:00
Andrew Murray
b4e6cdadac Added py3 variable to _util 2018-04-20 09:19:13 +10:00
Eric Soroos
768668c1d7 Added RGB*;16N Unpackers 2017-12-20 13:53:14 +00:00