【问题标题】:Download animated gif images in Java在 Java 中下载动画 gif 图像
【发布时间】:2015-11-12 19:51:11
【问题描述】:

我正在尝试使用 Java 下载动画 gif 图像,但下载的图像会丢失动画。这是我的代码:

    BufferedImage image = ImageIO.read(new URL("http://gifntext.com/images/football_small.gif"));
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream);
    image.flush();
    ImageIO.write(image, "gif", bufferedOutputStream);
    bufferedOutputStream.flush();

    byte[] bytes = outputStream.toByteArray();
    File file = new File("/home/toan/football_small.gif");
    FileOutputStream out = new FileOutputStream(file);

    out.write(bytes);
    out.flush();
    out.close();
    outputStream.close();
    bufferedOutputStream.close();

这段代码有什么问题吗? 提前致谢。

【问题讨论】:

标签: java image


【解决方案1】:

【讨论】:

    猜你喜欢
    • 2016-05-24
    • 2013-08-09
    • 2016-02-02
    • 2013-03-20
    • 2016-03-24
    • 2016-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多