Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/stamp/preprocessing/tiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,16 @@ def tiles_with_cache(
"w",
) as tile_zip_fp:
tile.image.save(
tile_zip_fp, format=EXTENSION_TO_FORMAT[cache_tiles_ext]
tile_zip_fp,
format=EXTENSION_TO_FORMAT[cache_tiles_ext],
**(
# Remove ICC profile for PNG images because that sometimes produces >1MB metadata,
# causing "ValueError: Decompressed data too large for PngImagePlugin.MAX_TEXT_CHUNK".
# Importantly, this does NOT affect the contents of np.array(tile.image).
dict(icc_profile=None)
if cache_tiles_ext == "png"
else {}
),
)

yield tile
Expand Down