-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
Using img.render() with an ImageData.data array with too many bands fails with
CPLE_NotSupportedError: PNG driver doesn't support 5 bands. Must be 1 (grey), 2 (grey+alpha), 3 (rgb) or 4 (rgba) bands.
Example:
src_path = "https://naipblobs.blob.core.windows.net/naip/v002/al/2019/al_60cm_2019/30087/m_3008701_ne_16_060_20191115.tif"
with COGReader(src_path) as cog:
img = cog.preview()
print(img.data.shape) # >>> (4, 1024, 892)
img.render()
Reading all bands and later visualizing a band subset (without mutating the array) seems like a common usecase. Would propose to add an indexes parameter to .render(), so that specific bands can be selected for the vizualization.
Happy to make a PR, but wanted to check first if there is a better solution or this is not intended etc.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels