Java Utililty Methods BufferedImage to String

List of utility methods to do BufferedImage to String

Description

The list of methods to do BufferedImage to String are organized into topic(s).

Method

StringencodeToString(BufferedImage image, String type)
Encode image to string
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ImageIO.write(image, type, bos);
byte[] imageBytes = bos.toByteArray();
BASE64Encoder encoder = new BASE64Encoder();
String imageString = encoder.encode(imageBytes);
bos.close();
return imageString;
StringencodeToString(BufferedImage image, String type)
Encode to string.
String imageString = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
    ImageIO.write(image, type, bos);
    byte[] imageBytes = bos.toByteArray();
    imageString = DatatypeConverter.printBase64Binary(imageBytes);
    bos.close();
} catch (IOException e) {
...
StringencodeToString(BufferedImage image, String type)
encode To String
String imageString = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
    ImageIO.write(image, type, bos);
    byte[] imageBytes = bos.toByteArray();
    BASE64Encoder encoder = new BASE64Encoder();
    imageString = encoder.encode(imageBytes);
    bos.close();
...