Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

bounds are outside of the dimensions of the source image #95

Open
tvqphong001 opened this issue May 27, 2022 · 1 comment
Open

bounds are outside of the dimensions of the source image #95

tvqphong001 opened this issue May 27, 2022 · 1 comment

Comments

@tvqphong001
Copy link

tvqphong001 commented May 27, 2022

In my device google pixel 4 or some devices image is horizontal. You need check rotate and rotate bitmap with code below if don't want error

    int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
    Log.d("EXIF", "Exif: " + orientation);
    Matrix matrix = new Matrix();
    float degrees = 0;
    if (orientation == ExifInterface.ORIENTATION_ROTATE_90) {
        matrix.postRotate(90);
    }
    else if (orientation == ExifInterface.ORIENTATION_ROTATE_180) {
        matrix.postRotate(180);
    }
    else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) {
        matrix.postRotate(270);
    }

    Bitmap flipBitmap =  Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
    bmp = Bitmap.createBitmap(flipBitmap, originX, originY, width, height);

Hope it helpful

@AntoineChauviere
Copy link

It is possible to add this in the library ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants