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

Add hs.image.imageFromData() #1486

Open
cmsj opened this issue Jul 11, 2017 · 3 comments
Open

Add hs.image.imageFromData() #1486

cmsj opened this issue Jul 11, 2017 · 3 comments

Comments

@cmsj
Copy link
Member

cmsj commented Jul 11, 2017

We don't currently have a constructor for taking a Lua bytestream and turning it into an hs.image object, for example if one is fetching an image with hs.http.

(we have hs.image.imageFromURL(), but afaics that's a blocking call)

@asmagill
Copy link
Member

asmagill commented Sep 1, 2017

If the binary data is encoded as a URL string, hs.image.imageFromURL will convert it to an image... as I recall, an encoded image string is base64 encoded with a prefix of `data:;base64,'.

hs.image:encodeAsURLString will take an existing image you've picked up from some source and convert it into a proper string for you (my intention was to add image saving to my clipboard manager, but I haven't got around to it yet)

Or do you want something that can take incoming binary data as a stream (like stdin and hs.task)?

@cmsj
Copy link
Member Author

cmsj commented Sep 1, 2017

I think at the time I filed this, I was mostly thinking about fetching an image with the async variants of hs.http, but stdin/hs.task are also possibilities.

@asmagill
Copy link
Member

asmagill commented Sep 1, 2017

K, wasn't entirely sure what you wanted here so I figured I'd point these out in case you had missed them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants