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

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

@tvqphong001

Description

@tvqphong001

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions