Class ImageUtil
java.lang.Object
fc.util.ImageUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic BufferedImageResizes the specified image file to the new width and height and returns the new image.static voidResizes the specified image file to the new width and height and writes it to the targetFile (creating the targetFile if it does not already exist).static voidResizes the specified image file to the new width and height and writes it to the targetFile (creating the targetFile if it does not already exist).
-
Constructor Details
-
ImageUtil
public ImageUtil()
-
-
Method Details
-
resize
public static void resize(File sourceFile, File targetFile, String format, int newWidth, int newHeight) throws IOException Resizes the specified image file to the new width and height and writes it to the targetFile (creating the targetFile if it does not already exist).The format string is the output format of the file, like "jpg", "gif" etc. This can be different than the format of the source file. The understood formats are those understood
(the usual suspects like gif, jpg, png, etc, all seem to work).invalid reference
javax.io.ImageWriter- Throws:
IOException
-
resize
public static void resize(File sourceFile, File targetFile, int newWidth, int newHeight) throws IOException Resizes the specified image file to the new width and height and writes it to the targetFile (creating the targetFile if it does not already exist).The output format is the same as the input format and is intuited from the file name extension of the specified source file (therefore, source files specified to this method, should be like
foo.gif,foo.jpg, etc).- Throws:
IOException
-
resize
Resizes the specified image file to the new width and height and returns the new image.- Throws:
IOException
-
main
- Throws:
IOException
-