admin管理员组文章数量:1432205
I use TOAST UI Component Image Editor on a webpage. I'd like to to save the image to Base64 string. There are no properties in imageEditor object to allow me to access the edited image in canvas. I searched Google and Stackoverflow, no results.
I use TOAST UI Component Image Editor on a webpage. I'd like to to save the image to Base64 string. There are no properties in imageEditor object to allow me to access the edited image in canvas. I searched Google and Stackoverflow, no results.
Share Improve this question edited Apr 24, 2024 at 5:30 Andrew Gaul 2,4121 gold badge14 silver badges19 bronze badges asked Aug 11, 2018 at 21:26 yW0K5oyW0K5o 9431 gold badge18 silver badges34 bronze badges 2- 1 try to take a look to this answer In any case I assume there should be a download method – gaetanoM Commented Aug 11, 2018 at 21:46
- @gaetanoM, Thank you for your response. I take a look at download method. – yW0K5o Commented Aug 11, 2018 at 22:05
2 Answers
Reset to default 4I checked the file tui-image-editor.js for download function as suggested by gaetanoM.
The solution is to call for base64 string of the edited image. The base64 string starts after the data:image/png;base64, prefix.
imageEditor.toDataURL();
Where imageEditor is a global JavaScript variable declared during image load.
It is using fabric.js library. You can access the canvas object directly by :
ImageEditor._graphics.getCanvas();
it will give you a fabric object, assign this to some variable and you can use fabric.js functions with this.
本文标签: javascriptHow to get access to canvas in the TOAST UI Component Image EditorStack Overflow
版权声明:本文标题:javascript - How to get access to canvas in the TOAST UI Component Image Editor? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745550281a2662911.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论