这类型的东西没接触过求助~

解决方案 »

  1.   

    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;import javax.imageio.ImageIO;public class ImageOper
    {
     
    public Image buildImage(String file) throws FileNotFoundException, IOException
    {
    return buildImage(new FileInputStream(new File(file)));
    }

    public Image buildImage(InputStream ins) throws IOException
    {
    return javax.imageio.ImageIO.read (ins);
    }  
    public BufferedImage buildBufferImage(Image img) {
    int w = img.getWidth(null); // 得到源图宽
    int h = img.getHeight(null); // 得到源图长 BufferedImage tag = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    tag.getGraphics().drawImage(img, 0, 0, w, h, null);
    return tag;
    }
    public void save(BufferedImage img, String file) throws IOException { OutputStream bos = new FileOutputStream(file);
    ImageIO.write(img, "gif", bos);
    bos.close();
    }         public static void main(String [] args)
            {
                   ImageOper imgio = ImageOper();
                   Image img = buildImage("c:\ss.bmp");
                   BufferedImage bg = buildBufferImage(img);
                   save(bg,"c:\ss.gif");
             }
    }
      

  2.   

    在意文件夹下的所有BMP文件都要转换 比如icon文件夹下的所有BMP文件如何转换?谢谢