Lab 2: Image Transformer

Overview

In this assignment, you will provide a simple Graphical User Interface that allows image files to be transformed using several specified transformations.

Pre-Lab (DUE BEFORE LAB - see due date in Canvas)

As part of the pre-lab activity you must ensure that you have JavaFX installed on your laptop.

Assignment

Create a JavaFX program that provides a user interface that matches the screenshot below.

User Interface
Figure 1: User Interface

When the user enters an input image filename in the first text field, an output image filename in the second text field, and then presses the Copy button, the program will read the specified image file and write it to the specified output file.

Details

Create a ImageCopy class that extends the Application class. This class will include your start() method that will create the GUI.

Replacing mocked Package

Copy your ImageIO class implementation from your lab 1 project into this project and incorporate feedback from your instructor (if available). Instead of using the classes/interfaces provided by the mocked package, you will use several JavaFX classes/interfaces:

To use these, replace the imports in ImageIO that used mocked with javafx.scene.image.

Support for .png Image Files

You must provide support for reading and writing images in the .png format. You must create two private class methods:

An Image class constructor supports reading PNG images. Writing PNG images is a bit more involved. It can be done using the javax.imageio.ImageIO.write() method, and you can use the javafx.embed.swing.SwingFXUtils.fromFXImage() method to get a BufferedImage (that is a RenderedImage).

Update the public read() and write() methods to call the readPNG() and writePNG() methods when appropriate.

Exception Handling

If any problems are encountered with reading the input files or writing the output file, the program should display a useful error message to the console and continue running. The program should not crash or display any exceptions.

Just For Fun

Ambitious students may wish to:

You can display an Image in the Scene by placing the Image in a ImageView.

Acknowledgement

This laboratory assignment, developed by Dr. Chris Taylor.

See your professor's instructions for details on submission guidelines and due dates.