Skip to content
This repository was archived by the owner on Sep 28, 2023. It is now read-only.

Implements in-memory loading of images #22

Closed
wants to merge 2 commits into from
Closed

Implements in-memory loading of images #22

wants to merge 2 commits into from

Conversation

soumith
Copy link
Member

@soumith soumith commented Jul 21, 2019

The following now works:

with open('chicago.jpg', 'rb') as f:
   img_bytes = f.read()
img = accimage.Image(img_bytes)

Fixes #2 cc: @vadimkantorov

@soumith soumith requested a review from willprice July 21, 2019 21:42
@vadimkantorov
Copy link

That issue dates a bit back :)

@@ -241,14 +241,28 @@ static PyTypeObject Image_Type = {
0, /*tp_is_gc*/
};

#if PY_MAJOR_VERSION == 2
#define PyUnicode_AsUTF8 PyString_AsString
#define PyUnicode_Check PyString_Check
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is going to work as strings in python 2 were bytes by default: b'hi' == 'hi'. This is why travis is failing at the moment. I'm not sure what we should do--drop python 2 support completely? (Although if torchvision is still supporting 2, so should accimage). If we need to support 2, perhaps we could ask for a bytesio object?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll fix it, i think I can make the in-memory option be a kwarg-only option probably.

@soumith
Copy link
Member Author

soumith commented Mar 5, 2020

i am closing this and calling work bankruptcy :)

@soumith soumith closed this Mar 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: loading jpeg from memory (ndarray and Tensor)
3 participants