Class ImageEncodingDecoding

java.lang.Object
de.iip_ecosphere.platform.kiServices.functions.images.ImageEncodingDecoding

public class ImageEncodingDecoding extends Object
Image decoding functionality.
Author:
Alexander Weber, SSE
  • Constructor Details

    • ImageEncodingDecoding

      public ImageEncodingDecoding()
  • Method Details

    • base64StringToBufferdImage

      public static BufferedImage base64StringToBufferdImage(String imageString) throws IOException
      Takes a base64 encoded byte-array of an image in form of a String and turns it into a BufferedImage for further processing.
      Parameters:
      imageString - The image to be converted.
      Returns:
      The image extracted from the String.
      Throws:
      IOException - If there is an error while converting the byte-array string to an image.
    • bufferedImageToBase64String

      public static String bufferedImageToBase64String(BufferedImage bimage)
      Utility function to turn a buffered image into a base64 encoded byte string for transportation.
      Parameters:
      bimage - the buffered image to convert
      Returns:
      the image in string form
    • readBase64FileAsBufferedImage

      public static BufferedImage readBase64FileAsBufferedImage(String inPath) throws IOException
      Utility to read an BufferedImage from a base64 file.
      Parameters:
      inPath - the location of the file.
      Returns:
      the BufferedImage.
      Throws:
      IOException - If the file cannot be found or the content does not match.
    • readBufferedImageFromFile

      public static BufferedImage readBufferedImageFromFile(String inPath) throws IOException
      Utility to read an BufferedImage from an image file. Using ImageIO.
      Parameters:
      inPath - the location of the File.
      Returns:
      the read Image.
      Throws:
      IOException - If the file cannot be found or cannot be read properly.
    • readImageAsBase64String

      public static String readImageAsBase64String(String inPath) throws IOException
      Utility method to create new test data from images, will be saved to the testimage folder.
      Parameters:
      inPath - Path to the image to use.
      Returns:
      String of base64 encoded Image.
      Throws:
      IOException - If the process fails to find, load or write to a file.
    • readBase64ImageFromBase64File

      public static String readBase64ImageFromBase64File(String path) throws IOException
      Reads a base64 encoded String out of a file.
      Parameters:
      path - the path to the file.
      Returns:
      the base64 encoded String.
      Throws:
      IOException - If the file does not exists or cannot be read.