安卓 圖片的壓縮 InputStream壓縮和Bitmap壓縮

對InputStream進行壓縮,即con.getInputStream()code

BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();  
bitmapOptions.inSampleSize = 10;  //壓縮爲原來的10分之一
bitmap = BitmapFactory.decodeStream(con.getInputStream(), null , bitmapOptions);

對Bitmap壓縮orm

bitmap.compress(Bitmap.CompressFormat.JPEG, 10, fos);     //10表明壓縮90%
相關文章
相關標籤/搜索