Class ImageEncodingDecoding
java.lang.Object
de.iip_ecosphere.platform.kiServices.functions.images.ImageEncodingDecoding
Image decoding functionality.
- Author:
- Alexander Weber, SSE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImagebase64StringToBufferdImage(String imageString) Takes a base64 encoded byte-array of an image in form of a String and turns it into a BufferedImage for further processing.static StringUtility function to turn a buffered image into a base64 encoded byte string for transportation.static BufferedImagereadBase64FileAsBufferedImage(String inPath) Utility to read an BufferedImage from a base64 file.static StringReads a base64 encoded String out of a file.static BufferedImagereadBufferedImageFromFile(String inPath) Utility to read an BufferedImage from an image file.static StringreadImageAsBase64String(String inPath) Utility method to create new test data from images, will be saved to the testimage folder.
-
Constructor Details
-
ImageEncodingDecoding
public ImageEncodingDecoding()
-
-
Method Details
-
base64StringToBufferdImage
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
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
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
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
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
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.
-