Java BufferedImage from String base64ToImg(String base64Strings)

Here you can find the source of base64ToImg(String base64Strings)

Description

base To Img

License

Open Source License

Declaration

public static BufferedImage base64ToImg(String base64Strings) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.image.BufferedImage;

import java.io.ByteArrayInputStream;

import java.io.IOException;

import javax.imageio.ImageIO;
import sun.misc.BASE64Decoder;

public class Main {

    public static BufferedImage base64ToImg(String base64Strings) {
        BufferedImage bi = null;//from   w  w  w  .  j ava  2s  .c  o m
        ByteArrayInputStream bais = null;
        BASE64Decoder decoder = new sun.misc.BASE64Decoder();
        byte[] bytes1;
        try {
            bytes1 = decoder.decodeBuffer(base64Strings);
            bais = new ByteArrayInputStream(bytes1);
            bi = ImageIO.read(bais);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return bi;
    }
}

Related

  1. base64StringToImage(String imageString)
  2. base64StringToImage(String imageString)
  3. base64StringToImg(final String base64String)
  4. base64ToImage(final String data, final int width, final int height)
  5. base64ToImage(String base64)
  6. decodeImage(String encoded)
  7. decodeImage(String imageString)
  8. decodeToImage(String imageString)
  9. decodeToImage(String imageString)