JavaFX支持哪种图像格式? [英] Which Image Formats does JavaFX Support?

查看:190
本文介绍了JavaFX支持哪种图像格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找JavaFX支持的图像类型(最新)列表,例如: PNG,JPEG,TIFF。不同的搜索引擎没有帮助...任何想法从哪里开始?

I am looking for a list of Image Types (latest) JavaFX supports, e.g. PNG, JPEG, TIFF. Different search engines did not help ... any idea where to start?

更具体我对16位灰度图像(不同格式)和罕见支持的jpg感兴趣-lossless标准。

More particulary I am interested in 16 Bit grayscale images (in different formats) and the rare supported jpg-lossless standard.

推荐答案

以下列表是根据Fireworks和Photoshop允许的选项另存为:加上一些选定的格式,考虑到常见的内容以及对ImageJ的一些支持。

The list below was generated based on the options that Fireworks and Photoshop allow one to Save As: plus a few selected formats by me considering what is commonly found and that have some support on ImageJ.

因此并不意味着ImageJ本身支持该格式,但这意味着即使需要额外的插件,也可以在ImageJ中打开。此列表不是ImageJ支持的完整列表,更详细一个(包括支持是本机还是通过插件请检查此页

Therefore the doesn't mean that the format is natively supported in ImageJ, but it means that it is possible to open in ImageJ even if it requires additional plugins. And this list is not a complete list of what is supported on ImageJ, for a more detailed one (including whether the support is native or through plugin please check this page)

File Format:    bits                details         Native support      ImageJ







PNG              32     fireworks format .fw.png          ✓               ✓
                 32              flat format              ✓               ✓
                 24              flat format              ✓               ✓







                 8               flat format              ✓               ✓
GIF              8       2 colours (black & white)        ✓               ✓
                 8               16 colours               ✓               ✓
                 8               256 colours              ✓               ✓ 







JPG              24             Quality: 100%             ✓               ✓
                 24         100% && Smoothing = 8         ✓               ✓
JPS (JPG Stereo) 24                                       ✓               ✓







MPO              24                                       ✓               ✓







TIFF             32                                       ✘               ✓
                 24                                       ✘               ✓
                  8                                       ✘               ✓







JPEG2000                                                  ✘               ✓
EPS                                                       ✘               ✓
TGA                                                       ✘               ✓
RAW (photoshop)                                           ✘               ✓
PSD                                                       ✘               ✓
FITs                                                      ✘               ✓
PGM (.pgm)                                                ✘               ✓
PPM (.ppm)                                                ✘               ✓
PBM (.pbm)                                                ✘               ✓
DICOM                                                     ✘               ✓
NiFTI                                                     ✘               ✓
PICT                                                      ✘               ✓
ICO                                                       ✘               ✓
ANALYZE                                                   ✘               ✓
MOV                                                       ✘               ✓
SPE (.spe)                                                ✘               ✓
PIC                                                       ✘               ✓
AVI (.avi)                                                ✘               ✓
CUR                                                       ✘               ✓
PXR (Pixar)                                               ✘               ✘ 
SCT (Scitex)                                              ✘               ✘ 
IFF                                                       ✘               ✘ 
WBMP                                                      ✘               ✘ 
PDF                                                       ✘               ✘ 

此测试是在Windows 8.1上制作:

This test was made on a Windows 8.1 with:

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

用于创建此列表的源代码:

Source code used to create this list:

import java.io.File;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

public class JavaFXSupportedImages extends Application {

    @Override
    public void start(Stage primaryStage) {
        File dir = new File("formats_supported_on_javaFX_folder");//Folder Path
        File[] images = dir.listFiles();
        GridPane root = new GridPane();
        int col=0, row=0;
        for(File f: images){
            Button btn = new Button(f.getName());
            try{
                Image fximage = new Image(f.toURI().toURL().toString());
                ImageView pic = new ImageView();
                pic.setImage(fximage);
                pic.setFitWidth(130);
                pic.setFitHeight(50);
                btn.setGraphic(pic);
            }catch(Exception e){
                System.out.println("JavaFX doesn't support: " + btn.getText());
            }
            if(col>3){
                col=0;
                row++;
            }
            else
            {
                col++;
            }
            root.add(btn, col, row);
        }
        Scene scene = new Scene(root, 300, 250);    
        primaryStage.setTitle("JavaFX Support test!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

这篇关于JavaFX支持哪种图像格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆