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.
Using the JavaFX Image API
Speed up JPEG decoding
Generate thumbnail images with less memory
Added support for image 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’.
|Image Format||Web||javafx.scene.image.Image||Snow Flower IIO|
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.
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 decodingWhen 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.
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.
BufferedImage bimg = SwingFXUtils.fromFXImage(fximage, null);
ImageIO.write(bimg, "image/png", new File("out.png"));
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.
Mac OS X
Mac OS X 10.12 Sierra and later. x64
Windows 7 and later x86
Windows 8 and later x64
Image file formart