On 28.1.2012 10:19, Kyle Huey wrote:
2012/1/28 Bronislav Klučka <[email protected] <mailto:[email protected]>>

    Hello,
    would it be possible to have Image.toBlob() function? We are
    introducing Canvas.toBlob(), image (and maybe video, audio) would
    be nice addition


    Brona


Proposing a more detailed spec would be a good place to start. Some example questions:

1. What does <img>.toBlob() do if the image failed to load?
2. Should <img>.toBlob() respect CORS?
3. Does <img>.toBlob() take a content type argument like the others? If so, what does <img src="foo.jpg">.toBlob("image/png") do?
4. Is <img>.toBlob() asynchronous like <canvas>.toBlob()?

I think the idea of implementing <img>.toBlob() is fine, but we need to spec out the behavior first.

- Kyle

Sure, sure just throwing the idea here.
I think whatever can be followed according to existing should be (the same signature as Canvas.toBlob, respecting crossorigin attribute, CORS) If there is failure possible in Canvas.toBlob(), this method should follow it, if not, error should be thrown once called on error image
<img src="foo.jpg">.toBlob("image/png") should return PNG

Basically the idea is, that this should replace for creating canvas, painting image on such canvas and calling canvas.toBlob().


Brona



Reply via email to