NODEJS Canvas to base64 png stream

微笑、不失礼 提交于 2019-12-14 02:36:17

问题


Imagine that i have a client that only can read base64 images and i want to show that images like a realtime movie (as less latency as possible).

This images are created on server side using nodejs canvas lib. For each image that i send to the client i see the difference between them with imagediff nodejs lib and i only send the difference match image.

In the client side i show it putting the last image exactly over the previous ones (layers).

The problem is that in server side i have the following values that slow down the process:

  1. 16ms: after draw canvas:

  2. 42ms: imagediff (imagediff nodejs lib)

  3. [100 to 250ms] - toDataUrl (canvas to png base64 - canvas nodejs lib toBuffer().toString('base64'))

The big issue is in 3.

Do you have a different solution for this?

Thanks for your time.

Eduardo

来源:https://stackoverflow.com/questions/13648633/nodejs-canvas-to-base64-png-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!