flutter_native_image icon indicating copy to clipboard operation
flutter_native_image copied to clipboard

bounds are outside of the dimensions of the source image

Open tvqphong001 opened this issue 2 years ago • 1 comments

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

tvqphong001 avatar May 27 '22 03:05 tvqphong001

It is possible to add this in the library ?

AntoineChauviere avatar Feb 26 '23 11:02 AntoineChauviere