# Compress **Repository Path**: Presley.Zheng/Compress ## Basic Information - **Project Name**: Compress - **Description**: 图片压缩 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2016-06-17 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #Compress 图片上传压缩策略 1. 获取缩放倍数 2. 按照缩放倍数解压得到Bitmap 3. 根据需要的策略大小缩放Bitmap 4. 将得到的Bitmap压缩编码至合适大小并保存文件 - 使用 ``` new CompressTask(new SampleSize(1024), new Scale(1024, 1024), new Save(context, 200 * 1024/*200KB*/)) { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected void onPostExecute(List strings) { super.onPostExecute(strings); } }.execute({image paths}); ```