How to use Data URI from Image as an InputStream?

后端 未结 1 1436
礼貌的吻别
礼貌的吻别 2020-12-19 10:38

I have retrieved the base64 data uri from a html5 canvas. Within my servlet, I would like to decode the data uri and use it as an input stream as shown in \"xxx\" below. The

相关标签:
1条回答
  • 2020-12-19 11:05

    This needs almost the exact opposite to this answer! Or at least, the reverse of it. It answers Image to base 64 String, whereas this use-case is String to Image.

    Look to javax.xml.bind.DatatypeConverter.parseBase64Binary(String) to get a byte[] of the String.

    Use the byte[] to construct a ByteArrayInputStream.

    0 讨论(0)
提交回复
热议问题