Android:从exhif界面获取缩小的图片

时间:2016-03-15 06:45:09

标签: android exif

我使用Exif界面来获得所需的图像方向,但我得到的位图只是原始图像的一部分缩小以适合imageView。如何获得整个图像(图像分辨率 - 2048 x 1152)?

bitmap1 = BitmapFactory.decodeFile(selectedImagePath);
                    int rotate = 0;
                    try {
                        ExifInterface exif = new ExifInterface(selectedImagePath);
                        int orientation = exif.getAttributeInt(
                                ExifInterface.TAG_ORIENTATION,
                                ExifInterface.ORIENTATION_NORMAL);

                        switch (orientation) {
                            case ExifInterface.ORIENTATION_ROTATE_270:
                                rotate = 270;
                                break;
                            case ExifInterface.ORIENTATION_ROTATE_180:
                                rotate = 180;
                                break;
                            case ExifInterface.ORIENTATION_ROTATE_90:
                                rotate = 90;
                                break;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    Matrix matrix = new Matrix();
                    matrix.postRotate(rotate);
                    bitmap1 = Bitmap.createBitmap(bitmap1, 0, 0, bitmap1.getWidth(),bitmap1.getHeight(), matrix, true);

0 个答案:

没有答案