You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most obviously, the lack of symmetry is problematic. VideoEncoder and AudioEncoder provide a wealth of controls not reflected in <canvas> + createImageBitmap() hacks for image encoding but which are naturally part of the underlying codec's APIs. To get a sense for this gap, you can see many of the unexposed dimensions in the interface of squoosh when toggling between browser encoding for JEPG and MozJEPG (see the "advanced" section).
Less obviously, toDataURL() and friends deal in blobs and provide a synchronous API, while ImageDecoder (correctly) exposes a Promise-based API for per-frame decode. A symmetric, async, per-frame encode API with similar levels of control should be made available to improve overall application responsiveness.
On a related note, popular implementations of toDataURL() are missing AVIF support. This is a gap that an official ImageEncoder class should also close.
The text was updated successfully, but these errors were encountered:
WebCodecs, today, provides:
The spec doesn't currently contain an
ImageEncoder
, and when I've discussed this with folks in the past, they suggest (ab)using<canvas>
'stoDataURL()
method. This is unsatisfying.Most obviously, the lack of symmetry is problematic.
VideoEncoder
andAudioEncoder
provide a wealth of controls not reflected in<canvas>
+createImageBitmap()
hacks for image encoding but which are naturally part of the underlying codec's APIs. To get a sense for this gap, you can see many of the unexposed dimensions in the interface ofsquoosh
when toggling between browser encoding for JEPG and MozJEPG (see the "advanced" section).Less obviously,
toDataURL()
and friends deal in blobs and provide a synchronous API, whileImageDecoder
(correctly) exposes a Promise-based API for per-frame decode. A symmetric, async, per-frame encode API with similar levels of control should be made available to improve overall application responsiveness.On a related note, popular implementations of
toDataURL()
are missing AVIF support. This is a gap that an officialImageEncoder
class should also close.The text was updated successfully, but these errors were encountered: