Convert bitarray to image

138 Views Asked by At

I have large bitarray as a start 100 000 000 bits i.e. 10000x10000.

What is the most feasible and economic way to convert it to scaled down version may be 1000x1000, by preserving best the dot|1 distribution. I dont know if B&W or gray img will be better.

For the array I'm using the bitarray module and for the image bockeh and as a fallback option matplotlib.

In the past for small imgs I used img.show, but i had to convert the bitarray to numpy, which i dont think is feasible for such large arrays.

BTW. I can use Cython if this will involve looping trough the bitarray

1

There are 1 best solutions below

3
James A. Bednar On

I'd use Datashader for this. If you can get it into an xarray data structure, the easiest way to view it using Datashader + Bokeh is to install hvPlot then import hvplot.xarray and do .hvplot() as described at https://hvplot.holoviz.org/user_guide/Gridded_Data.html. You can then zoom into the plot and see any region in as much detail as you like.