Snow Flower IIO Overview

Snow Flower IIO is a library that extends JavaFX IIO (Image IO). JPEG 2000 and TIFF images can be handled directly with JavaFX Image API. Since it can be used transparently from the JavaFX standard API, developers can use it without additional learning.

Features
  • Using the JavaFX Image API

  • Speed up JPEG decoding

  • Generate thumbnail images with less memory

  • Added support for image format

    • TIFF format

    • JPEG 2000 format

    • Microsoft ICO format

The advantage of the JavaFX Image API

The JavaFX Image API has a function to specify size when loading. The application can specify the quality of the filtering to use when scaling and whether to preserve the aspect ratio of the original image. This is a function not found in javax.imageio.ImageIO. By using the JavaFX Image API when generating thumbnail images you can keep the maximum memory usage lower than using the javax.imageio.ImageIO API.

Comparison of supported image formats

The following table compares the supported image formats of the Web platform, JavaFX Image API, ‘Snow Flower IIO’.

Table 1. Image file format support comparison table
Image FormatWebjavafx.scene.image.ImageSnow Flower IIO

JPEG

Yes

Yes

Yes1

BMP

Yes

Yes

Yes

GIF

Yes

Yes

Yes

PNG

Yes

Yes

Yes

TIFF

No

No

Yes

JPEG2000

No

No

Yes

ICO

No

No

Yes

The image format supported by JavaFX standard Image API is equivalent to Web browser, Snow Flower IIO adds support for image file formats that are often used in native applications that the JavaFX standard runtime does not support.

The image file format that can be used with the Web browser is limited to those commonly available in Safari, Internet Explorer, Chrome, and Firefox which are representative Web browsers.

  1. Snow Flower IIO has replaced the loader of the JPEG file format which is considered to be the most commonly used by the high speed loader. We also make improvements in the scope of JavaFX standard API support.

Speed up JPEG decoding
When decoding a JPEG file, Snow Flower IIO uses libjpeg-turbo instead of the libjpeg library used by the JavaFX standard runtime. By optimizing SIMD (MMX, SSE, SSE2), libjpeg-turbo decodes about 2 to 4 times faster than libjpeg.

How to use API

Use JavaFX’s Image API as it is.

Example of loading image file
import javafx.scene.image.Image;

Image image1 = new Image("sample.jpg");
Image image2 = new Image("sample.jp2");
Image image3 = new Image("sample.tiff");

Since JavaFX Image API currently does not support exporting images to files, convert them to AWT / Image (Buffered Image) and output using the javax.imageio.ImageIO API.

Example of exporting to image file
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;

BufferedImage bimg = SwingFXUtils.fromFXImage(fximage, null);
ImageIO.write(bimg, "image/png", new File("out.png"));

Operating environment

The Snow Flower IIO library will work in all environments where JavaVM runs, but JPEG acceleration will only be effective on the following platforms: For platforms that do not support standard loader is used.

Effective platform of JPEG accelerated decoder
  • Mac OS X

    • Mac OS X 10.12 Sierra and later. x64

  • Windows

    • Windows 7 and later x86

    • Windows 8 and later x64

  • Linux

    • Linux x86

    • Linux x64