public static String iconToBytesPreview(Icon icon, int maxSize) throws IOException {
    if (icon.getIconHeight() <= maxSize && icon.getIconWidth() <= maxSize) {
      return imageToBytes(toImage(icon));
    }
    return null;
  }
public static String iconToBytesPreview(Icon icon, int maxSize)