/** * Retrieve a compressed image from a base-64 encoded PNG file. * @param base64 - the base 64-encoded PNG. * @return The compressed image. */ public static CompressedImage fromBase64Png(String base64) { try { return new EncodedCompressedImage("data:image/png;base64," + base64); } catch (IllegalArgumentException e) { // Remind the caller throw new IllegalArgumentException("Must be a pure base64 encoded string. Cannot be an encoded text.", e); } }
/** * Retrieve a compressed image from an encoded text. * @param text - the encoded text. * @return The corresponding compressed image. */ public static CompressedImage fromEncodedText(String text) { return new EncodedCompressedImage(text); }