.tif
最小限の数の追加ライブラリを使用してJavaで を表示しようとしています。
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
import javax.media.jai.widget.*;
import it.geosolutions.imageio.utilities.*;
import it.geosolutions.imageioimpl.plugins.tiff.*;
import com.sun.media.imageioimpl.common.*;
public static void main(String[] args) {
try {
File f = new File("image.tif");
BufferedImage tif = ImageIO.read(f);
ImageIcon ic = new ImageIcon(tif);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JLabel label = new JLabel(ic);
frame.add(label);
frame.setVisible(true);
} catch (IOException e) {
e.printStackTrace();
}
}
私が使用しているライブラリは次のとおりです。
jai-core-1.1.3.jar
jai-imageio-1.1.jar
imageio-ext-tiff.1.1.3.jar
imageio-ext-utilities.1.1.3.jar
ここから:http://java.net/projects/imageio-ext(右側のダウンロードリンク)
ただし、表示される画像は次のとおりです。 これは明らかに元の画像ではありません。また、私が知っているエラーがスローされることもありません。さらに、元の画像はきれいで、変化しません。
ただし、元のコードは小さいです。私は実際にはインポートを使用しませんが、imageio-ext
インポートがないとプログラムは失敗します。私もimageio-ext
以前は使ったことがありません。
助けてください!.tif
ソフトウェアをインストールせずにJavaで画像を使用できるようにする必要があります。