Merge pull request #214 from cgohlke/patch-1

BUG: Fix io.imsave() problems with passing arguments to plugin "freeimage".
This commit is contained in:
Stefan van der Walt
2012-07-12 10:44:34 -07:00
+15 -15
View File
@@ -156,20 +156,20 @@ class FI_TYPES(object):
}
fi_types = {
(numpy.uint8, 1): FIT_BITMAP,
(numpy.uint8, 3): FIT_BITMAP,
(numpy.uint8, 4): FIT_BITMAP,
(numpy.uint16, 1): FIT_UINT16,
(numpy.int16, 1): FIT_INT16,
(numpy.uint32, 1): FIT_UINT32,
(numpy.int32, 1): FIT_INT32,
(numpy.float32, 1): FIT_FLOAT,
(numpy.float64, 1): FIT_DOUBLE,
(numpy.complex128, 1): FIT_COMPLEX,
(numpy.uint16, 3): FIT_RGB16,
(numpy.uint16, 4): FIT_RGBA16,
(numpy.float32, 3): FIT_RGBF,
(numpy.float32, 4): FIT_RGBAF
(numpy.dtype('uint8'), 1): FIT_BITMAP,
(numpy.dtype('uint8'), 3): FIT_BITMAP,
(numpy.dtype('uint8'), 4): FIT_BITMAP,
(numpy.dtype('uint16'), 1): FIT_UINT16,
(numpy.dtype('int16'), 1): FIT_INT16,
(numpy.dtype('uint32'), 1): FIT_UINT32,
(numpy.dtype('int32'), 1): FIT_INT32,
(numpy.dtype('float32'), 1): FIT_FLOAT,
(numpy.dtype('float64'), 1): FIT_DOUBLE,
(numpy.dtype('complex128'), 1): FIT_COMPLEX,
(numpy.dtype('uint16'), 3): FIT_RGB16,
(numpy.dtype('uint16'), 4): FIT_RGBA16,
(numpy.dtype('float32'), 3): FIT_RGBF,
(numpy.dtype('float32'), 4): FIT_RGBAF
}
extra_dims = {
@@ -624,7 +624,7 @@ def _array_to_bitmap(array):
else:
n_channels = shape[0]
try:
fi_type = FI_TYPES.fi_types[(dtype.type, n_channels)]
fi_type = FI_TYPES.fi_types[(dtype, n_channels)]
except KeyError:
raise ValueError('Cannot write arrays of given type and shape.')