Package edu.msoe.cs1021
Class ImageUtil
- java.lang.Object
-
- edu.msoe.cs1021.ImageUtil
-
public final class ImageUtil extends java.lang.Object
Image utility class to facilitate reading/writing standard image formats and provide additional helper methods related to images.- Version:
- 20190125.1
- Author:
- taylor
-
-
Constructor Summary
Constructors Constructor Description ImageUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javafx.scene.image.Image
convolve(javafx.scene.image.Image image, double[] kernel)
Returns an image that has the filter kernel applied to it.static javafx.scene.image.Image
readImage(java.nio.file.Path path)
Returns an Image as a result of decoding a supplied Path.static void
writeImage(java.nio.file.Path path, javafx.scene.image.Image image)
Writes the image to the file specified by path.
-
-
-
Method Detail
-
writeImage
public static void writeImage(java.nio.file.Path path, javafx.scene.image.Image image) throws java.io.IOException
Writes the image to the file specified by path. The image format is based on the file extension specified in the path.- Parameters:
path
- Location of the image fileimage
- The image to be written- Throws:
java.lang.IllegalArgumentException
- if the path extension specifies an unsupported image formatjava.io.IOException
- if an error occurs during reading
-
readImage
public static javafx.scene.image.Image readImage(java.nio.file.Path path) throws java.io.IOException
Returns an Image as a result of decoding a supplied Path.- Parameters:
path
- Location of the image file to read- Returns:
- an Image containing the decoded contents of the input
- Throws:
java.lang.IllegalArgumentException
- if path is nulljava.io.IOException
- if an error occurs during reading
-
convolve
public static javafx.scene.image.Image convolve(javafx.scene.image.Image image, double[] kernel)
Returns an image that has the filter kernel applied to it.- Parameters:
image
- the image on which the filter is appliedkernel
- the filter kernel to apply to the image- Returns:
- The resulting image after the filter kernel has been applied to image.
-
-