对您而言可能有用的一个库可能是Java Advanced Imaging
Library(JAI)。
使用此库可能比使用ImageIO复杂得多,但是在我刚刚运行的快速测试中,它确实打开并显示了您链接的问题图像文件。
public static void main(String[] args) { RenderedImage image = JAI.create("fileload", "estacaosp.jpg"); float scale=(float) 0.5; ParameterBlock pb = new ParameterBlock(); pb.addSource(image); pb.add(scale); pb.add(scale); pb.add(1.0F); pb.add(1.0F); pb.add(new InterpolationNearest() );// ;InterpolationBilinear()); image = JAI.create("scale", pb); // Create an instance of DisplayJAI. DisplayJAI srcdj = new DisplayJAI(image); JScrollPane srcScrollPaneImage = new JScrollPane(srcdj);// Use a label to display the image Jframe frame = new Jframe(); frame.getContentPane().add(srcScrollPaneImage, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }运行此代码后,图像似乎可以正常加载。然后使用ParamaterBlock将其调整为50%
最后,如果您想保存文件,可以致电:
String filename2 = new String ("tofile.jpg"); String format = new String ("JPEG"); RenderedOp op = JAI.create ("filestore", image, filename2, format);我希望这能够帮到你。祝你好运。



