Skip to content

Commit ca9f4a4

Browse files
authored
fix pillow deprecation warning for mode argument in fromarray (#368)
1 parent d96321a commit ca9f4a4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

terracotta/image.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ def array_to_png(
4141
if colormap is not None:
4242
raise ValueError("Colormap argument cannot be given for multi-band data")
4343

44-
mode = "RGB"
4544
transparency = (0, 0, 0)
4645
palette = None
4746

4847
elif img_data.ndim == 2: # encode paletted image
49-
mode = "L"
5048

5149
if colormap is None:
5250
palette = None
@@ -106,7 +104,7 @@ def array_to_png(
106104
if isinstance(img_data, np.ma.MaskedArray):
107105
img_data = img_data.filled(0)
108106

109-
img = Image.fromarray(img_data, mode=mode)
107+
img = Image.fromarray(img_data)
110108

111109
if palette is not None:
112110
img.putpalette(palette)

0 commit comments

Comments
 (0)