Class PromptImageFormatConverters
java.lang.Object
de.xima.fc.prompt.service.support.PromptImageFormatConverters
Factory for common image format converters.
- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic IPromptImageFormatConverterconvertToFormat(String format) Creates an image format converter that always changes the image format to the given target format.static IPromptImageFormatConverterensureFormat(Iterable<String> formats) Creates an image format converter that ensures the image is in one of the given formats.static IPromptImageFormatConverterensureFormat(String... formats) Creates an image format converter that ensures the image is in one of the given formats.
-
Method Details
-
convertToFormat
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
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
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.
-