Skip to content

Commit 4b5e044

Browse files
committed
Fix incorrect imageio calls in examples
1 parent f553f45 commit 4b5e044

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
"iinfo",
190190
"IJKL",
191191
"imageio",
192+
"imread",
192193
"INCOL",
193194
"INROW",
194195
"interactable",

tcod/tileset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,20 @@ def set_tile(self, codepoint: int, tile: ArrayLike | NDArray[np.uint8]) -> None:
126126
# Normal usage when a tile already has its own alpha channel.
127127
# The loaded tile must be the correct shape for the tileset you assign it to.
128128
# The tile is assigned to a private use area and will not conflict with any exiting codepoint.
129-
tileset.set_tile(0x100000, imageio.load("rgba_tile.png"))
129+
tileset.set_tile(0x100000, imageio.imread("rgba_tile.png"))
130130
131131
# Load a greyscale tile.
132-
tileset.set_tile(0x100001, imageio.load("greyscale_tile.png"), pilmode="L")
132+
tileset.set_tile(0x100001, imageio.imread("greyscale_tile.png"), mode="L")
133133
# If you are stuck with an RGB array then you can use the red channel as the input: `rgb[:, :, 0]`
134134
135135
# Loads an RGB sprite without a background.
136-
tileset.set_tile(0x100002, imageio.load("rgb_no_background.png", pilmode="RGBA"))
136+
tileset.set_tile(0x100002, imageio.imread("rgb_no_background.png", mode="RGBA"))
137137
# If you're stuck with an RGB array then you can pad the channel axis with an alpha of 255:
138138
# rgba = np.pad(rgb, pad_width=((0, 0), (0, 0), (0, 1)), constant_values=255)
139139
140140
# Loads an RGB sprite with a key color background.
141141
KEY_COLOR = np.asarray((255, 0, 255), dtype=np.uint8)
142-
sprite_rgb = imageio.load("rgb_tile.png")
142+
sprite_rgb = imageio.imread("rgb_tile.png")
143143
# Compare the RGB colors to KEY_COLOR, compress full matches to a 2D mask.
144144
sprite_mask = (sprite_rgb != KEY_COLOR).all(axis=2)
145145
# Generate the alpha array, with 255 as the foreground and 0 as the background.

0 commit comments

Comments
 (0)