gif,pgn,jpg都应该支持阿,google查java缩略图,肯定有,我用过的

解决方案 »

  1.   

    不行啊,兄弟,我用JPEGImageEncoder这个生成的GIF显示不出来,java又不提供其他的类,我在google找了半天也没有发现GIF图片的缩略图了,如果你有代码,能否发过来看看呢,现在的高手估计都冬眠了,晕
      

  2.   

    try
    {
    File _file = new File("C:\\256823.gif");                       //读入文件
    Image src = javax.imageio.ImageIO.read(_file);                     //构造Image对象
    int wideth=src.getWidth(null);                                     //得到源图宽
    int height=src.getHeight(null);                                    //得到源图长
    BufferedImage tag = new BufferedImage(wideth/2,height/2,BufferedImage.TYPE_INT_RGB);
    tag.getGraphics().drawImage(src,0,0,wideth/2,height/2,null);       //绘制缩小后的图
    FileOutputStream out=new FileOutputStream("C:\\newfile.gif");          //输出到文件流
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);       
    encoder.encode(tag);                                               //近JPEG编码
    //System.out.print(width+"*"+height);                              
    out.close();
    }
    catch(Exception ex)
    {
      System.out.println(ex.getMessage());
    }
    以上是我实现的代码,为什么转换后的GIF显示不了,肯定是转换有问题了,请高手指点啊
      

  3.   

    以前做过把两张图片拼成一张,主要用的是java.awt.image.WritableRaster和BufferedImage,具体代码忘了,应该也能缩小图片
      

  4.   

    怎么没有人来回家这个问题了,不可能没有人碰到过没解决的。有没有第三方控件呢,?高手,帮忙,已经找了两天的时间没有搞定了。HELP,XDJM
      

  5.   

    <%@ page import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*" %>
    <%
    // 在内存中创建图象
    int width=60, height=20;
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    //输出图像
    ImageIO.write(image, "JPEG", response.getOutputStream());
    %>
      

  6.   

    你这个只给生成JPEG的吧,我现在要GIF的,郁闷啊