Skip to content

Commit af7bdb4

Browse files
committed
Update pillow to 11.0
1 parent 34aff08 commit af7bdb4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ dependencies = [
6363
"minecraft-render~=2.0.0a6",
6464

6565
# Favicons deps, because it's vendored
66-
"pillow~=9.5.0",
66+
"pillow~=11.0",
6767
"rich~=13.3.4",
6868
"svglib~=1.5.1",
6969
]

src/hexdoc/graphics/render.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ def render_block(
242242
logger.debug(f"Loading texture {name}: {info}")
243243
image = Image.open(info.image_path).convert("RGBA")
244244

245-
min_alpha, _ = cast(tuple[int, int], image.getextrema()[3])
245+
extrema = image.getextrema()
246+
assert len(extrema) >= 4, f"Expected 4 bands but got {len(extrema)}"
247+
min_alpha, _ = extrema[3]
246248
if min_alpha < 255:
247249
logger.debug(f"Transparent texture: {name} ({min_alpha=})")
248250
transparent_textures.add(name)
@@ -355,7 +357,7 @@ def render_block(
355357
mode="RGBA",
356358
size=self.wnd.fbo.size,
357359
data=self.wnd.fbo.read(components=4),
358-
).transpose(Image.FLIP_TOP_BOTTOM)
360+
).transpose(Image.Transpose.FLIP_TOP_BOTTOM)
359361

360362
output_path.parent.mkdir(parents=True, exist_ok=True)
361363
image.save(output_path, format="png")

0 commit comments

Comments
 (0)