public static boolean canWriteImage(ImageTypeSpecifier type) {
    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();
    return (sm.getNumBands() >= 2 && sm.getNumBands() <= 4 || cm instanceof IndexColorModel) &&
           sm.getSampleSize(0) <= 8 &&
           sm.getWidth() <= 65535 &&
           sm.getHeight() <= 65535 &&
           (cm == null || cm.getComponentSize()[0] <= 8) &&
           WebpNativeLibHelper.loadNativeLibraryIfNeeded();
  }
public static boolean canWriteImage(ImageTypeSpecifier type)