Re: Image.toBlob()

On 2.2.2012 23:24, Anne van Kesteren wrote:
> On Sat, 28 Jan 2012 09:27:08 +0100, Bronislav Klučka 
> <Bronislav.Klucka@bauglir.com> wrote:
>> would it be possible to have Image.toBlob() function? We are 
>> introducing Canvas.toBlob(), image (and maybe video, audio) would be 
>> nice addition
>
> Are the additional resource required to drawing the image on <canvas> 
> first a bottleneck?
>
>
There may be additional changes to images being applied in document 
(CSS: width, height, CSS filters) and I would prefer drawImage to have 
the displayed image as its source, but then I have no way to get to the 
underlying/original data of that resource (before any transformation).
Basically anything, that can be understood as an resource should have 
toBlob() (Canvas, Image, Video, Audio, Document).
But as Charles mentioned before me, maybe stream would be even better. 
Assuming we would redefine Blob as a descendant of stream - file stream 
(seekable stream in oppose to nonseekable stream e.g. network stream). 
We have started with a lot of helpers to avoid working with chunks of 
bytes, when working with resources (XHR Blob send; draw image on canvas, 
play audio), then there are APIs like AudioApi allowing to work with 
underlying data, but still media specific. And it would be nice to have 
one basic way to reduce any resource to sequence of bytes.


Brona

Received on Friday, 3 February 2012 03:35:23 UTC