Class PromptImageFormatConverters

java.lang.Object
de.xima.fc.prompt.service.support.PromptImageFormatConverters

public final class PromptImageFormatConverters extends Object
Factory for common image format converters.
Since:
8.5.0
  • Method Details

    • convertToFormat

      public static IPromptImageFormatConverter convertToFormat(String format)
      Creates an image format converter that always changes the image format to the given target format.
      Parameters:
      format - The target format, e.g. "png" or "jpeg".
      Returns:
      The converter.
    • ensureFormat

      public static IPromptImageFormatConverter ensureFormat(String... formats)
      Creates an image format converter that ensures the image is in one of the given formats. If the image is already in one of the given formats, the format is preserved; otherwise, the image format is changed to the first of the given formats.
      Parameters:
      formats - The allowed formats, e.g. "png" or "jpeg".
      Returns:
      The converter.
    • ensureFormat

      public static IPromptImageFormatConverter ensureFormat(Iterable<String> formats)
      Creates an image format converter that ensures the image is in one of the given formats. If the image is already in one of the given formats, the format is preserved; otherwise, the image format is changed to the first of the given formats.
      Parameters:
      formats - The allowed formats, e.g. "png" or "jpeg".
      Returns:
      The converter.