• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            xiaoguozi's Blog
            Pay it forword - 我并不覺的自豪,我所嘗試的事情都失敗了······習慣原本生活的人不容易改變,就算現狀很糟,他們也很難改變,在過程中,他們還是放棄了······他們一放棄,大家就都是輸家······讓愛傳出去,很困難,也無法預料,人們需要更細心的觀察別人,要隨時注意才能保護別人,因為他們未必知道自己要什么·····
            package JingJiaGuo;

            import javax.imageio.*;
            import java.awt.image.*;
            import java.io.*;
            public class Image{
                
            public Image(String path)
                
            throws IOException{
                    bi
            =ImageIO.read(new File(path));
                    weight
            =bi.getWidth();
                    height
            =bi.getHeight();
                }

                
            public void SaveTo(String path,String formatname,int maxlen,boolean flag)
                
            throws FileNotFoundException,IOException{
                    
            int nw=weight,nh=height;
                    
            if(flag){
                        
            if(weight>maxlen){
                            nw
            =maxlen;
                            nh
            =height*nw/weight;
                            
            if(nh>maxlen){
                                nh
            =maxlen;
                                nw
            =weight*nh/height;
                            }

                        }

                        
            if(height>maxlen){
                            nh
            =maxlen;
                            nw
            =weight*nh/height;
                            
            if(nw>maxlen){
                                nw
            =maxlen;
                                nh
            =height*nw/weight;
                            }

                        }

                    }
            else{
                        nw
            =nh=maxlen;
                    }

                    
            int imagetype=BufferedImage.TYPE_INT_RGB;
                    
            if(formatname!="jpeg")imagetype=BufferedImage.TYPE_4BYTE_ABGR_PRE;
                    
                    ByteArrayOutputStream bous
            =new ByteArrayOutputStream();
                    BufferedImage tmp
            =new BufferedImage(nw,nh,imagetype);
                    tmp.getGraphics().drawImage(bi,
            0,0,nw,nh,null);
                    ImageIO.write(tmp,formatname,bous);
                    
                    FileOutputStream fos
            =new FileOutputStream(path);
                    fos.write(bous.toByteArray());
                    fos.close();
                }

                
            public int weight,height;
                
            public BufferedImage bi;
            }

            暫時未支持動態的gif,不過好像有個開源的gif89的一個開源庫,里面有支持動態的gif圖像處理的,記下學習筆記
            posted on 2009-05-13 22:19 小果子 閱讀(188) 評論(0)  編輯 收藏 引用 所屬分類: 學習筆記
            99久久香蕉国产线看观香| 国产成人精品久久综合| 伊人久久大香线蕉AV色婷婷色| 久久久久久久久久久久久久| 亚洲va久久久噜噜噜久久天堂 | 午夜精品久久久久久| 久久久久久免费视频| 国产午夜久久影院| 亚洲色欲久久久久综合网| 国产精品久久久亚洲| 三级片免费观看久久| 久久99国产精品久久久| 久久久午夜精品福利内容| 久久精品国产亚洲麻豆| 久久亚洲AV无码精品色午夜| 99久久婷婷国产综合精品草原| 亚洲精品午夜国产VA久久成人 | 国产偷久久久精品专区| 国产午夜福利精品久久| 久久久久亚洲AV成人片| 久久亚洲AV无码精品色午夜麻豆| 久久精品国产99国产电影网| 一本色综合网久久| 亚洲精品国产综合久久一线| 国产精品九九久久免费视频| 欧美噜噜久久久XXX| 亚洲熟妇无码另类久久久| 久久久久女教师免费一区| 亚洲国产精品久久久久久| 91精品国产9l久久久久| 少妇久久久久久久久久| 日本久久久久亚洲中字幕| 久久人妻AV中文字幕| 久久精品免费一区二区| 无码任你躁久久久久久老妇| 亚洲欧洲久久av| 久久精品人人做人人爽电影| 久久久精品人妻一区二区三区蜜桃 | 久久99这里只有精品国产| 婷婷久久综合九色综合九七| 精品免费久久久久国产一区 |