如何在Java中将FITS转换为JPG?

时间:2021-12-11 21:20:20

I need to convert a fits file to jpg in java. I've tried with imageJ but I need a simple library without GUI. I'm developing a web page in java and I need to convert the file in background (headlessly).

我需要在java中将fit文件转换为jpg。我尝试过使用imageJ,但我需要一个没有GUI的简单库。我正在用java开发一个网页,我需要在后台转换文件(无头)。

1 个解决方案

#1


1  

Alex solved it by doing this:

亚历克斯解决了这个问题:

public void fitsToJpg(String source, String destination, String image){
    try {
    ImagePlus imageP = openImage(source+image);
    final File out = new File(destination+"preview.jpg");
    BufferedImage imagen = imageP.getBufferedImage();
    ImageIO.write(imagen, "jpg", out);
    } catch (IOException ex) {
        Logger.getLogger(Fits.class.getName()).log(Level.SEVERE, null, ex);
    }
}

#1


1  

Alex solved it by doing this:

亚历克斯解决了这个问题:

public void fitsToJpg(String source, String destination, String image){
    try {
    ImagePlus imageP = openImage(source+image);
    final File out = new File(destination+"preview.jpg");
    BufferedImage imagen = imageP.getBufferedImage();
    ImageIO.write(imagen, "jpg", out);
    } catch (IOException ex) {
        Logger.getLogger(Fits.class.getName()).log(Level.SEVERE, null, ex);
    }
}