Skip to content

Incorrect scaling on Android #150

Closed
@jthure

Description

@jthure

Environment

Android

Description

I'm experiencing an issue when trying to scale a large image down to a lot smaller size. No cropping involved, although I don't think that matter.

If I'm not misunderstanding how things work, the code related to sample size in cropAndResizeTask is incorrect. outOptions.inSampleSize is calculated and set, and then the parameters to Bitmap.createBitmap are modified based on the resulting value, but the bitmap is never decoded, from which the new resulting is created from, is never decoded using the options object and specifically the inSampleSize. Therefore, if getDecodeSampleSize returns a sampleSize greater than 1, the parameters to Bitmap.createBitmap is downscaled, which results in a undesired "cropping" of the resulting bitmap

Reproducible Demo

Try to scale down (no cropping) an image to such an target size that the getDecodeSampleSize method returns a value greater than 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions