You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Using
img.render()
with an ImageData.data array with too many bands fails withCPLE_NotSupportedError: PNG driver doesn't support 5 bands. Must be 1 (grey), 2 (grey+alpha), 3 (rgb) or 4 (rgba) bands.
Example:
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.
The text was updated successfully, but these errors were encountered: