Skip to content

Square cropper does not crop a perfect square (off by 1 pixel) #429

@Dora567

Description

@Dora567

Hey!

I am using this library to create square images. I set the AvatarEditor width and height to 320. If I crop a 700x800 image with scale 1, the result is always 700x699px instead of 700x700px.

The issue seems to be that the 700x800 image is scaled down to 320x366 to be displayed in the cropper. There is already some precision issue there (700/320 = 2.1875, 800/366 = 2.185792349726776). Then the downscaled proportions are used to calculate scaling: 320/366 = 0.8743169398907104 and we end up with 800 * 0.8743169398907104 = 699.4535519125683 instead of 700.

Is it possible to improve this?

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