goja-core/src/main/java/goja/core/libs/Images.java
public static String toBase64(File image) throws IOException {
        return "data:" + MimeTypes.getMimeType(image.getName()) + ";base64," + Codec.encodeBASE64(
                IO.readContent(image));
    }
public static String toBase64(File image) throws IOException {
        return "data:" + MimeTypes.getMimeType(image.getName()) + ";base64," + Codec.encodeBASE64(
                IO.readContent(image));
    }
Encode an image to base64 using a data: URI

@param image The image file
@return The base64 encoded value