Partial loading?
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?
Might be possible with the new fetch api
https://fetch.spec.whatwg.org/#fetch-api http://caniuse.com/#search=fetch
@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