package com.huatek.sales.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import>
public> image.compress(Bitmap.CompressFormat.JPEG, 100, baos);//质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中
> while ( baos.toByteArray().length / 1024>100) { //循环判断如果压缩后图片是否大于100kb,大于继续压缩
> }
ByteArrayInputStream> Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);//把ByteArrayInputStream数据生成图片
return bitmap;
}
/**
* 创建1280*720分辨率的图片
* @param> BitmapFactory.Options opts = new BitmapFactory.Options();
> BitmapFactory.decodeFile(filePath, opts);
> opts.inJustDecodeBounds = false;
try {
//照片尺寸被缩小了1/4
> } catch (Exception e) {
// TODO: handle exception
}
//恢复bitmap尺寸大小
return big(bitmap);
}
private static Bitmap big(Bitmap bitmap) {
if(bitmap != null) {
Matrix> matrix.postScale(1.33333334f,1.33333334f); //长和宽放大缩小的比例
Bitmap> return resizeBmp;
} else {
return bitmap;
}
}
public static int computeSampleSize(BitmapFactory.Options options,
int> maxNumOfPixels);
> roundedSize = 1;
> }
}> }
return> double h = options.outHeight;
> .sqrt(w * h / maxNumOfPixels));
> Math.floor(w / minSideLength), Math.floor(h / minSideLength));
> return 1;
}> return lowerBound;
}> try {
ExifInterface> int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
> break;
> break;
> break;
}
}> matrix.postRotate(angle);
// 创建新的图片
Bitmap> bitmap.getWidth(), bitmap.getHeight(), matrix, true);
return resizedBitmap;
}
}
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import>
public> image.compress(Bitmap.CompressFormat.JPEG, 100, baos);//质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中
> while ( baos.toByteArray().length / 1024>100) { //循环判断如果压缩后图片是否大于100kb,大于继续压缩
> }
ByteArrayInputStream> Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);//把ByteArrayInputStream数据生成图片
return bitmap;
}
/**
* 创建1280*720分辨率的图片
* @param> BitmapFactory.Options opts = new BitmapFactory.Options();
> BitmapFactory.decodeFile(filePath, opts);
> opts.inJustDecodeBounds = false;
try {
//照片尺寸被缩小了1/4
> } catch (Exception e) {
// TODO: handle exception
}
//恢复bitmap尺寸大小
return big(bitmap);
}
private static Bitmap big(Bitmap bitmap) {
if(bitmap != null) {
Matrix> matrix.postScale(1.33333334f,1.33333334f); //长和宽放大缩小的比例
Bitmap> return resizeBmp;
} else {
return bitmap;
}
}
public static int computeSampleSize(BitmapFactory.Options options,
int> maxNumOfPixels);
> roundedSize = 1;
> }
}> }
return> double h = options.outHeight;
> .sqrt(w * h / maxNumOfPixels));
> Math.floor(w / minSideLength), Math.floor(h / minSideLength));
> return 1;
}> return lowerBound;
}> try {
ExifInterface> int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
> break;
> break;
> break;
}
}> matrix.postRotate(angle);
// 创建新的图片
Bitmap> bitmap.getWidth(), bitmap.getHeight(), matrix, true);
return resizedBitmap;
}
}