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

Partial loading? #22

Open
eeeps opened this issue Jun 12, 2016 · 2 comments
Open

Partial loading? #22

eeeps opened this issue Jun 12, 2016 · 2 comments

Comments

@eeeps
Copy link

eeeps commented Jun 12, 2016

Under “Controlling the image dimensions” here it talks about partially decoding the image to fit a canvas element’s actual size... is there any way to partially load the FLIF resource as well, with, say, HTTP range requests?

@jnordberg
Copy link

Might be possible with the new fetch api

https://fetch.spec.whatwg.org/#fetch-api
http://caniuse.com/#search=fetch

@hrj
Copy link
Member

hrj commented Jun 13, 2016

@eeeps Thanks for bringing it up. There are actually many related questions:

1. Can the user load a resource partially and pass it to our low-level API?

Yes, XHR allows partial content to be requested. This requires server side support and requires user to know in advance how much partial data to fetch.

fetch mentioned by @jnordberg might also be a good solution; I don't know much about it.

2. Can the user stream data to our low-level API, and stop the stream midway?

This would be the ideal solution. It would allow decoding to continue in parallel with data download, and stopping when the target resolution is reached. But this requires the decoding to yield to the JS event loop. It's a hard problem to solve; issue #19 tracks this.

3. Can the library automatically handle this for the declarative API?

Yes, if the partial size is indicated as an attribute. In this case, we can use the XHR partial content strategy.

If the size is not known, then we are back to #19

hrj added a commit that referenced this issue Jun 26, 2016
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

3 participants