What did you do?
Save a multiframe tiff image with group3 compression and PhotometricInterpretation WhiteIsZero.
What did you expect to happen?
Settings applied to all frames.
pageaaa.tif: TIFF image data, little-endian, direntries=9, height=2291, bps=1, compression=bi-level group 3, PhotometricInterpretation=WhiteIsZero, width=1686
pageaab.tif: TIFF image data, little-endian, direntries=9, height=2291, bps=1, compression=bi-level group 3, PhotometricInterpretation=WhiteIsZero, width=1686
pageaac.tif: TIFF image data, little-endian, direntries=9, height=2291, bps=1, compression=bi-level group 3, PhotometricInterpretation=WhiteIsZero, width=1686
pageaad.tif: TIFF image data, little-endian, direntries=9, height=2291, bps=1, compression=bi-level group 3, PhotometricInterpretation=WhiteIsZero, width=1686
What actually happened?
Settings apply only to the first frame.
Pageaaa.tif: TIFF image data, little-endian, direntries=9, height=2291, bps=1, compression=bi-level group 3, PhotometricInterpretation=WhiteIsZero, width=1686
pageaab.tif: TIFF image data, little-endian, direntries=8, height=2291, compression=none, PhotometricInterpretation=BlackIsZero, width=1686
pageaac.tif: TIFF image data, little-endian, direntries=8, height=2291, compression=none, PhotometricInterpretation=BlackIsZero, width=1686
pageaad.tif: TIFF image data, little-endian, direntries=8, height=2291, compression=none, PhotometricInterpretation=BlackIsZero, width=1686
What are your OS, Python and Pillow versions?
- OS: Ubuntu 24.04 LTS
- Python: 3.12.3
- Pillow: 11.2.1
Pillow 11.1.0 yields the expected result.
git bisect results:
5c93145061953d8633397bb79ace396ab1e71eb5 is the first bad commit
commit 5c93145061953d8633397bb79ace396ab1e71eb5
Author: Andrew Murray <radarhere@users.noreply.github.com>
Date: Fri Feb 28 22:16:52 2025 +1100
Allow encoderconfig and encoderinfo to be set for appended TIFF images
Tests/test_file_tiff.py | 12 ++++++++++++
docs/handbook/image-file-formats.rst | 4 +---
src/PIL/TiffImagePlugin.py | 15 ++++++---------
3 files changed, 19 insertions(+), 12 deletions(-)
Example code:
from PIL import Image
fax_images = []
for page in ["img/1.png", "img/2.png", "img/3.png", "img/4.png"]:
image = Image.open(page)
image = image.convert(mode="1")
fax_images.append(image)
# TIFF settings (0 is white)
tiffinfo = {262: 0}
first = fax_images.pop(0)
first.save(
"fax-document.tif",
"TIFF",
append_images=fax_images,
save_all=True,
compression="group3",
tiffinfo=tiffinfo,
)
Test commands:
python test-case.py
tiffsplit fax-document.tif page
file page*tif
What did you do?
Save a multiframe tiff image with group3 compression and PhotometricInterpretation WhiteIsZero.
What did you expect to happen?
Settings applied to all frames.
What actually happened?
Settings apply only to the first frame.
What are your OS, Python and Pillow versions?
Pillow 11.1.0 yields the expected result.
git bisect results:
Example code:
Test commands:
python test-case.py tiffsplit fax-document.tif page file page*tif