Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File object support for imread and imsave #3124

Merged
merged 2 commits into from
Feb 24, 2014
Merged

File object support for imread and imsave #3124

merged 2 commits into from
Feb 24, 2014

Conversation

jleinonen
Copy link
Contributor

Made changes to image reading and writing routines to support file objects properly. Actually scipy.misc.imread didn't have to be changed because PIL already supports file objects, but I changed the docstring to say explicitly that it supports them. I made similar changes to scipy.ndimage.misc.imread, though I'm not quite sure why that can't just import from scipy.misc.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling f63f3aa on jleinonen:master into 5739a8b on scipy:master.

@rgommers
Copy link
Member

Thanks for the fix. I'll try to have a closer look at this in a few days.

It's indeed ugly that we have two imread functions. We should take over the latest fixes that were made to this function in scikit-image and deprecate misc.imread.

@rgommers
Copy link
Member

rgommers commented Feb 2, 2014

OK I'm not going to get around to reworking the misc module any time soon. So we should merge this PR.

@@ -100,21 +100,21 @@ def bytescale(data, cmin=None, cmax=None, high=255, low=0):
return cast[uint8](bytedata) + cast[uint8](low)


def imread(name,flatten=0):
def imread(imfile, flatten=0):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a backwards compatibility break, because you can use positional arguments like kwargs (like imread(name='fname.png')). So can you undo this change?

@rgommers
Copy link
Member

rgommers commented Feb 2, 2014

Can you add a test for the functionality you add here to ndimage/tests/test_io.py?

@rgommers
Copy link
Member

rgommers commented Feb 2, 2014

With a test and undoing the rename this should be good to go.

@jleinonen
Copy link
Contributor Author

Finally got around to make these changes.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 60a43ae on jleinonen:master into 5739a8b on scipy:master.

@pv pv added PR labels Feb 19, 2014
pv added a commit that referenced this pull request Feb 24, 2014
ENH: misc: File object support for imread and imsave
@pv pv merged commit 60a43ae into scipy:master Feb 24, 2014
@pv
Copy link
Member

pv commented Feb 24, 2014

Thanks, merged.

@pv pv added this to the 0.14.0 milestone Feb 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants