Class 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImageUtil

        public ImageUtil()
    • 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 file
        image - The image to be written
        Throws:
        java.lang.IllegalArgumentException - if the path extension specifies an unsupported image format
        java.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 null
        java.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 applied
        kernel - the filter kernel to apply to the image
        Returns:
        The resulting image after the filter kernel has been applied to image.