Java android ExifInterface调整大小并保存后丢失

时间:2019-05-01 13:30:45

标签: java android

调整照片大小时,我丢失了一个ExifInterface。拍了张照片。

这就是我最小化照片的方式:

public static void minimizeImageWithPicasso(Context context, final File file, int targetSize, Handler handler) {
    // First decode with inJustDecodeBounds=true to check dimensions
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeFile(file.getPath(), options);
    float ratio = Math.max(options.outWidth, options.outHeight) / (float) targetSize;
    //don't scale image that is smaller than targetSize
    if (ratio < 1) return;
    int dstWidth = (int) (options.outWidth / ratio);
    int dstHeight = (int) (options.outHeight / ratio);
    PicassoTargetFactory.getInstance().putTarget(file, handler);
    Picasso.get()
            .load(file)
            .resize(dstWidth, dstHeight)
            .centerCrop()
            .into(PicassoTargetFactory.getInstance().getTarget(file));

}

我想调整照片大小并仍然得到exif:lon lat,time,model等

0 个答案:

没有答案