code: @Nullable
    public static String rescaleImageAndEncodeAsBase64(@Nonnull final InputStream in, final int maxSize) throws IOException {
      final Image image = ImageIO.read(in);
      String result = null;
      if (image != null) {
        result = rescaleImageAndEncodeAsBase64(image, maxSize);
      }
      return result;
    }
docs: Load and encode image into Base64.
  
  @param in stream to read image
  @param maxSize max size of image, if less or zero then don't rescale
  @return null if it was impossible to load image for its format, loaded
  prepared image
  @throws IOException if any error during conversion or loading
  @since 1.4.0