Fix handling of imgnum

This commit is contained in:
Steven Silvester
2014-12-12 07:46:15 -06:00
parent 81d3065ec2
commit f7e984662a
+2 -2
View File
@@ -52,7 +52,7 @@ def imread(fname, dtype=None, img_num=None, **kwargs):
site = "http://pillow.readthedocs.org/en/latest/installation.html#external-libraries"
raise ValueError('Could not load "%s"\nPlease see documentation at: %s' % (fname, site))
else:
return pil_to_ndarray(im, dtype=dtype)
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
def pil_to_ndarray(im, dtype=None, img_num=None):
@@ -72,7 +72,7 @@ def pil_to_ndarray(im, dtype=None, img_num=None):
break
# seeking must be done sequentially
if img_num and not i == img_num:
if not img_num is None and not i == img_num:
i += 1
continue