0

I've a very large 2D array of floats (aprox half 40000 by 40000, each between 0.0 and 1.0) and I'd like to save them to an image in order to visualize the matrix which the array represents. I think that the most practical visualization for my purposes is a greyscale (8 bit) image where each pixel represent an entry of the 2D array using the grey value something like 255*(1-myarray[i][j])

I firstly tried with the Bitmap Class and the Setpixel function, it works for smaller array, but it won't create image of such size (it throws an InvalidParameter Exception, I suppose due to some kind overflow inside the object)

There's a way for saving directly the image to disk pixel by pixel? I'm looking for something that works like StreamWriter for text files.

If I can save directly in tiff format or something else that doesn't occupy several gigabytes of space it would be (of course) better =)

Thank you all!

SebaF_it
  • 1
  • 1
  • what about this thread? https://stackoverflow.com/questions/11182948/c-sharp-saving-huge-images – Jirka Jr Oct 02 '17 at 12:52
  • Easiest way is to write a RAW file which would occupy 40000^2 bytes. – Rotem Oct 02 '17 at 12:57
  • also this thread? https://stackoverflow.com/questions/10636620/generate-huge-image-in-c-sharp – Jirka Jr Oct 02 '17 at 13:07
  • surely linked threads, but I still think that the simplest way is to split the matrix in some images and then merge the pieces (In .png a 8192x8192 file of this type is about half a MB) but if there are other not too complicated way... – SebaF_it Oct 02 '17 at 14:39

0 Answers0