Remove as_grey from plugins

This commit is contained in:
Neil
2011-07-17 00:21:43 +02:00
parent 435a2dab55
commit a595f267fd
4 changed files with 5 additions and 16 deletions
+1 -3
View File
@@ -11,15 +11,13 @@ except ImportError:
"for further instructions.")
def imread(fname, as_grey=True, dtype=None):
def imread(fname, dtype=None):
"""Load an image from a FITS file.
Parameters
----------
fname : string
Image file name, e.g. ``test.fits``.
as_grey : bool
For FITS images, this is ignored (treated as True).
dtype : dtype, optional
For FITS, this argument is ignored because Stefan is planning on
removing the dtype argument from imread anyway.
@@ -496,25 +496,20 @@ def _array_to_bitmap(array):
raise
def imread(filename, as_grey=False):
def imread(filename):
"""
img = imread(filename, as_grey=False)
img = imread(filename)
Reads an image from file `filename`
Parameters
----------
filename : file name
as_grey : Whether to convert to grey scale image (default: no)
Returns
-------
img : ndarray
"""
img = read(filename)
if as_grey and len(img) == 3:
# these are the values that wikipedia says are typical
transform = numpy.array([ 0.30, 0.59, 0.11])
return numpy.dot(img, transform).astype('uint8')
return img
def imsave(filename, img):
+1 -5
View File
@@ -9,7 +9,7 @@ except ImportError:
"Please refer to http://pypi.python.org/pypi/PIL/ "
"for further instructions.")
def imread(fname, as_grey=False, dtype=None):
def imread(fname, dtype=None):
"""Load an image from file.
"""
@@ -20,10 +20,6 @@ def imread(fname, as_grey=False, dtype=None):
else:
im = im.convert('RGB')
if as_grey and not \
im.mode in ('1', 'L', 'I', 'F', 'I;16', 'I;16L', 'I;16B', 'LA'):
im = im.convert('F')
if 'A' in im.mode:
im = im.convert('RGBA')
+1 -1
View File
@@ -1,7 +1,7 @@
# This mock-up is called by ../tests/test_plugin.py
# to verify the behaviour of the plugin infrastructure
def imread(fname, as_grey=False, dtype=None):
def imread(fname, dtype=None):
assert fname == 'test.png'
assert dtype == 'i4'