JAVA base64与图片的转换
想看原文请移步下面 转载: https://www.jianshu.com/p/f9e04600bbf3 Base64生成图片的方法 /** * base64生成图片方法 * @param imgData base64字符串 * @param imgFilePath 图片的生成路径 * @return 是否生成成功 * @throws IOException */ public static String GenerateImage ( String imgData , String imgFilePath ) throws IOException { // 对字节数组字符串进行Base64解码并生成图片 if ( imgData == null ) // 图像数据为空 return "" ; //随机生成一个UUID并去除他的 "-" String s = UUID . randomUUID ( ) . toString ( ) . replaceAll ( "-" , "" ) ; imgFilePath += s + ".jpg" ; BASE64Decoder decoder = new BASE64Decoder ( ) ; OutputStream out = null ; try { out = new FileOutputStream ( imgFilePath )