Here you can find the source of decodeToImage(String imageString)
public static java.awt.image.BufferedImage decodeToImage(String imageString)
//package com.java2s; //License from project: Open Source License public class Main { public static java.awt.image.BufferedImage decodeToImage(String imageString) { java.awt.image.BufferedImage image = null; try {/*from w ww. j a v a 2 s . c om*/ String imgString = imageString.startsWith("data:image/") ? imageString.substring(imageString.indexOf(',') + 1) : imageString; java.io.InputStream stream = new java.io.ByteArrayInputStream( java.util.Base64.getDecoder().decode(imgString)); image = javax.imageio.ImageIO.read(stream); stream.close(); } catch (Exception e) { } return image; } }