Result of html5 Canvas getImageData or toDataURL - Which takes up more memory?

后端 未结 3 731
一向
一向 2020-12-24 14:10

Part of my app includes html5 photo editing using a mixture of standard 2d context canvases and webGL.

Anyway, I am saving \'undo\' states while the user is manipula

3条回答
  •  一向
    一向 (楼主)
    2020-12-24 14:40

    I just went through this the other day... the getImageData method returns an image object where the actual data is stored in a uint8array... you have to get the data converted to something your database can manage and its just not worth it, the final output is much larger than the toDataURL method

    Its also very simple to get toDataURL base64 string back onto the canvas... you just instantiate a new image and give the src the base64 string

提交回复
热议问题