Java BufferedImage from String decodeImage(String imageString)

Here you can find the source of decodeImage(String imageString)

Description

decode Image

License

Open Source License

Declaration

public static BufferedImage decodeImage(String imageString) 

Method Source Code


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

import java.io.*;

import java.awt.image.*;
import javax.imageio.*;
import javax.xml.bind.*;

public class Main {
    public static BufferedImage decodeImage(String imageString) {
        BufferedImage image = null;
        byte[] imageBytes;

        imageBytes = DatatypeConverter.parseBase64Binary(imageString);
        ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes);
        try {/*from ww  w  .  java 2 s .  com*/
            image = ImageIO.read(bis);
            bis.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return image;
    }
}

Related

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