code: @Nonnull
    public static String rescaleImageAndEncodeAsBase64(@Nonnull final File file, final int maxSize) throws IOException {
      final Image image = ImageIO.read(file);
      if (image == null) {
        throw new IllegalArgumentException("Can't load image file : " + file); //NOI18N
      }
      return rescaleImageAndEncodeAsBase64(image, maxSize);
    }
docs: Load and encode image into Base64 from file.
  
  @param file image file
  @param maxSize max size of image, if less or zero then don't rescale
  @return image
  @throws IOException if any error during conversion or loading
  @since 1.4.0