I was very happy to find the PythonMagick bindings, which actually allow me to reliably load 16-bit images. Yay! Thanks guys!
The bindings are, however, incomplete, which I'm sure you know, given that the last patch was about adding the MagickCore::ColorspaceType enum. There are other enums missing, making several exposed functions useless. One example: missing MagickCore::ImageType enum makes using Image::type() to make a grayscale image quite hard

Code: Select all
image = PythonMagick.Image(filename)
blob = PythonMagick.Blob()
image.write(blob, 'RGB', 16)
rawdata = b64decode(blob.base64())
img = np.ndarray((image.rows(), image.columns(), 3),
dtype='uint16', buffer=rawdata)
Code: Select all
cmap = 'RGB'
blob = PythonMagick.Blob()
blob.base64(b64encode(bytes(array)).decode('ascii'))
image = PythonMagick.Image(blob, PythonMagick.Geometry(width, height), 16, cmap)