public final class ImageConverterFactories extends Object
image converter factories
used by W2X.
Initially this registry contains only a factory based on
ImageIO
. This factory is used to convert TIFF images to
JPEG or PNG images. However for this conversion to work, you must use
Java 9 to run W2X.
This class is thread-safe.
Modifier and Type | Field and Description |
---|---|
static boolean |
trace
If
true , trace image conversions. |
Modifier and Type | Method and Description |
---|---|
static File |
convertImage(File imgFile,
String[] preferredExtensions)
Convenience method: find a factory allowing to convert specified
image file to SVG, PNG or JPEG, then use this factory to create
an image converter and then use the converter to perform
the file conversion.
|
static ImageConverterFactory |
get(String inExt,
String outExt)
Returns a factory allowing to convert specified input filename extension
to specified output filename extension.
|
static void |
register(ImageConverterFactory factory)
Registers specified factory.
|
public static void register(ImageConverterFactory factory)
public static ImageConverterFactory get(String inExt, String outExt)
Each registered factory is tested in turn, starting from the last registered ones.
inExt
- input filename extensionoutExt
- output filename extensionnull
otherwisepublic static File convertImage(File imgFile, String[] preferredExtensions)
imgFile
- an image filepreferredExtensions
- specifies preferred
converted image extensions.
It's an array containing 0 to 3 image file extensions: "svg", "png" and "jpeg". The order of the extensions specifies the preferred converted image format.
May be null
in which case
{"svg", "png", "jpeg"}
is used.
null
.
null
is returned in any of the following cases: