mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 02:06:18 +03:00
Add Tests for 2/4 bpp Tiff Grayscale Images
Including inverted and/or bit-order-reversed formats.
This commit is contained in:
parent
aa0636d811
commit
124bee0485
BIN
Tests/images/tiff_gray_2_4_bpp/hopper2.tif
Normal file
BIN
Tests/images/tiff_gray_2_4_bpp/hopper2.tif
Normal file
Binary file not shown.
BIN
Tests/images/tiff_gray_2_4_bpp/hopper2I.tif
Normal file
BIN
Tests/images/tiff_gray_2_4_bpp/hopper2I.tif
Normal file
Binary file not shown.
BIN
Tests/images/tiff_gray_2_4_bpp/hopper2IR.tif
Normal file
BIN
Tests/images/tiff_gray_2_4_bpp/hopper2IR.tif
Normal file
Binary file not shown.
BIN
Tests/images/tiff_gray_2_4_bpp/hopper2R.tif
Normal file
BIN
Tests/images/tiff_gray_2_4_bpp/hopper2R.tif
Normal file
Binary file not shown.
BIN
Tests/images/tiff_gray_2_4_bpp/hopper4.tif
Normal file
BIN
Tests/images/tiff_gray_2_4_bpp/hopper4.tif
Normal file
Binary file not shown.
BIN
Tests/images/tiff_gray_2_4_bpp/hopper4I.tif
Normal file
BIN
Tests/images/tiff_gray_2_4_bpp/hopper4I.tif
Normal file
Binary file not shown.
BIN
Tests/images/tiff_gray_2_4_bpp/hopper4IR.tif
Normal file
BIN
Tests/images/tiff_gray_2_4_bpp/hopper4IR.tif
Normal file
Binary file not shown.
BIN
Tests/images/tiff_gray_2_4_bpp/hopper4R.tif
Normal file
BIN
Tests/images/tiff_gray_2_4_bpp/hopper4R.tif
Normal file
Binary file not shown.
|
@ -421,6 +421,39 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
self.assertEqual(im.mode, "L")
|
||||
self.assert_image_similar(im, original, 7.3)
|
||||
|
||||
def test_gray_semibyte_per_pixel(self):
|
||||
test_files = (
|
||||
(
|
||||
24.8,#epsilon
|
||||
(#group
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper2.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper2I.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper2R.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper2IR.tif",
|
||||
)
|
||||
),
|
||||
(
|
||||
7.3,#epsilon
|
||||
(#group
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper4.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper4I.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper4R.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper4IR.tif",
|
||||
)
|
||||
),
|
||||
)
|
||||
original = hopper("L")
|
||||
for epsilon, group in test_files:
|
||||
im = Image.open(group[0])
|
||||
self.assertEqual(im.size, (128, 128))
|
||||
self.assertEqual(im.mode, "L")
|
||||
self.assert_image_similar(im, original, epsilon)
|
||||
for file in group[1:]:
|
||||
im2 = Image.open(file)
|
||||
self.assertEqual(im2.size, (128, 128))
|
||||
self.assertEqual(im2.mode, "L")
|
||||
self.assert_image_equal(im, im2)
|
||||
|
||||
def test_save_bytesio(self):
|
||||
# PR 1011
|
||||
# Test TIFF saving to io.BytesIO() object.
|
||||
|
|
|
@ -323,6 +323,39 @@ class TestFileTiff(PillowTestCase):
|
|||
self.assertEqual(im.mode, "L")
|
||||
self.assert_image_similar(im, original, 7.3)
|
||||
|
||||
def test_gray_semibyte_per_pixel(self):
|
||||
test_files = (
|
||||
(
|
||||
24.8,#epsilon
|
||||
(#group
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper2.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper2I.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper2R.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper2IR.tif",
|
||||
)
|
||||
),
|
||||
(
|
||||
7.3,#epsilon
|
||||
(#group
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper4.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper4I.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper4R.tif",
|
||||
"Tests/images/tiff_gray_2_4_bpp/hopper4IR.tif",
|
||||
)
|
||||
),
|
||||
)
|
||||
original = hopper("L")
|
||||
for epsilon, group in test_files:
|
||||
im = Image.open(group[0])
|
||||
self.assertEqual(im.size, (128, 128))
|
||||
self.assertEqual(im.mode, "L")
|
||||
self.assert_image_similar(im, original, epsilon)
|
||||
for file in group[1:]:
|
||||
im2 = Image.open(file)
|
||||
self.assertEqual(im2.size, (128, 128))
|
||||
self.assertEqual(im2.mode, "L")
|
||||
self.assert_image_equal(im, im2)
|
||||
|
||||
def test_page_number_x_0(self):
|
||||
# Issue 973
|
||||
# Test TIFF with tag 297 (Page Number) having value of 0 0.
|
||||
|
|
Loading…
Reference in New Issue
Block a user