flutter-custom-image-crop icon indicating copy to clipboard operation
flutter-custom-image-crop copied to clipboard

Crop bug if Ratio width < height

Open Z6P0 opened this issue 1 year ago • 6 comments

I tested with ratio: Ratio(width: 2, height: 3) and the cropped image does not match. It works with square and width > height.

Z6P0 avatar Feb 01 '24 17:02 Z6P0

Hello, @Z6P0 I faced the same issue earlier, I understand the core code and made changes in one of the file in library. then its works fine

Please do changes in that file and check

  • in calculate_on_crop_params.dart file -caclulateOnCropParams function

replace below code at the end , It will definitely works,

I made changes in cropSizeHeight, cropSizeWidth parameter according to aspect ratio

final double cropSizeWidth; final double cropSizeHeight; if (aspectRatio > 1) { cropSizeWidth = cropSizeMax; cropSizeHeight = cropSizeWidth / aspectRatio; } else { cropSizeHeight = cropSizeMax / aspectRatio; cropSizeWidth = cropSizeHeight * aspectRatio; } return OnCropParams( cropSizeHeight: cropSizeHeight, cropSizeWidth: cropSizeWidth, translateScale: translateScale, scale: scale, );

Thanks

RockyPanchal avatar Feb 29 '24 07:02 RockyPanchal

Also face the same issue @ikbendewilliam @vanlooverenkoen please take a look

TarasBounty avatar Mar 21 '24 14:03 TarasBounty

@TarasBounty , Please check my answer, It will help you as i faced it and solve

RockyPanchal avatar Mar 21 '24 14:03 RockyPanchal

@RockyPanchal Thanks, I saw it. Hope @ikbendewilliam will fix it in the next package release and we can use it without a "fork workaround"

TarasBounty avatar Mar 21 '24 14:03 TarasBounty

Currently we are very busy with projects, if you have a fork with a fix, please create a PR so we can have this fix available for everyone :-)

ikbendewilliam avatar May 14 '24 06:05 ikbendewilliam

Currently we are very busy with projects, if you have a fork with a fix, please create a PR so we can have this fix available for everyone :-)

@RockyPanchal

TarasBounty avatar Jul 29 '24 14:07 TarasBounty

Fixes have been merged and published in v0.1.0

ikbendewilliam avatar Dec 30 '24 13:12 ikbendewilliam