Package com.xmlmind.w2x.docx.image
Class ImageConverterFactoryImpl
- java.lang.Object
-
- com.xmlmind.w2x.docx.image.ImageConverterFactoryImpl
-
- All Implemented Interfaces:
ImageConverterFactory
public final class ImageConverterFactoryImpl extends Object implements ImageConverterFactory
Image converter factory leveragingImageIOused to convert TIFF images to PNG or JPEG.However, for the conversion to be performed, you must use Java 9+ to run W2X.
This class is thread-safe.
-
-
Constructor Summary
Constructors Constructor Description ImageConverterFactoryImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ImageConvertercreateImageConverter(String inExt, String outExt)Returns a image converter allowing to convert an image file having first specified filename extension to an image file having second specified filename extension.static booleancropImage(File inFile, double top, double right, double bottom, double left, File outFile)String[]getImageConversions()Returns an array containing pairs of strings specifying the image conversions supported by converters created by this factory.StringgetParameter(String name)Returns the value of specified parameter.voidsetParameter(String name, String value)Sets specified parameter.
-
-
-
Method Detail
-
setParameter
public void setParameter(String name, String value)
Description copied from interface:ImageConverterFactorySets specified parameter.- Specified by:
setParameterin interfaceImageConverterFactory- Parameters:
name- name of parametervalue- value of parameter; usenullto unset it- See Also:
ImageConverterFactory.getParameter(java.lang.String)
-
getParameter
public String getParameter(String name)
Description copied from interface:ImageConverterFactoryReturns the value of specified parameter.- Specified by:
getParameterin interfaceImageConverterFactory- Parameters:
name- name of parameter- Returns:
- value of the parameter if set;
nullotherwise - See Also:
ImageConverterFactory.setParameter(java.lang.String, java.lang.String)
-
getImageConversions
public String[] getImageConversions()
Description copied from interface:ImageConverterFactoryReturns an array containing pairs of strings specifying the image conversions supported by converters created by this factory.First element of the pair is an input file extension in lower-case. Examples:
wmf,emf,tif,tiff.Second element of the pair is an output file extension in lower-case. Examples:
svg,png,jpg,jpeg.- Specified by:
getImageConversionsin interfaceImageConverterFactory
-
createImageConverter
public ImageConverter createImageConverter(String inExt, String outExt) throws Exception
Description copied from interface:ImageConverterFactoryReturns a image converter allowing to convert an image file having first specified filename extension to an image file having second specified filename extension.- Specified by:
createImageConverterin interfaceImageConverterFactory- Parameters:
inExt- the input filename extensionoutExt- the output filename extension- Throws:
Exception- if for any reason this method fails
-
cropImage
public static boolean cropImage(File inFile, double top, double right, double bottom, double left, File outFile) throws IOException
- Throws:
IOException
-
-