qimage2ndarray icon indicating copy to clipboard operation
qimage2ndarray copied to clipboard

uint16 numpy array to qimage with 16 Bits and view support

Open burakmartin opened this issue 1 year ago • 1 comments

Hey, I would like to create a QImage from a 16Bit numpy array and ideally without converting to 8Bit, aswell as creating a view into the memory of the 16Bit image. Is this possible?

burakmartin avatar Apr 17 '24 14:04 burakmartin

If you find a format supported by QImage here: https://doc.qt.io/qt-6/qimage.html#Format-enum then it should be possible. (It is not clear what you mean with 16 bits, for instance there are Format_Grayscale16, Format_RGB16, Format_RGB555, Format_ARGB4444_Premultiplied and others.)

If you want to work with views only (no copying), then you should create a QImage with the desired properties, create a view into it, and fill that with numpy operations (many, but not all numpy operations allow specifying the target array instead of creating their own).

hmeine avatar May 09 '25 09:05 hmeine