nanchen2251 / CompressHelper

:fire: 压缩文件,压缩图片,压缩Bitmap,Compress, CompressImage, CompressFile, CompressBitmap:https://github.com/nanchen2251/AiYaCompressHelper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

代码当中有一块很不解

sychaos opened this issue · comments

        // 采用 ExitInterface 设置图片旋转方向
        ExifInterface exif;
        try {
            exif = new ExifInterface(filePath);
            int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
            Matrix matrix = new Matrix();
            if (orientation == 6) {
                matrix.postRotate(90);
            } else if (orientation == 3) {
                matrix.postRotate(180);
            } else if (orientation == 8) {
                matrix.postRotate(270);
            }
            scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0,
                    scaledBitmap.getWidth(), scaledBitmap.getHeight(),
                    matrix, true);
        } catch (IOException e) {
            e.printStackTrace();
        }

这是在缩放法压缩后 又生成了一个scaledBitmap 但是 目前并没有发现他有什么用处,请指教