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

App crash if big size image is provided #105

Open
@farrakhj

Description

In the below method from EditImageActivity app crashes if large image(provided 14MB image) is provided.
private Single loadImage(String filePath) {
return Single.fromCallable(() -> BitmapUtils.getSampledBitmap(filePath, imageWidth,
imageHeight));
}

public static Bitmap getSampledBitmap(String filePath, int reqWidth, int reqHeight) throws FileNotFoundException {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
options.inPreferredConfig = Bitmap.Config.RGB_565;
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(filePath, options);
}

If image size is small or big getSampleBitmap method always calculate sample size as 1.

If anyone faced this issue please post against this issue.

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