Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken iOS resize logic #124

Merged
merged 4 commits into from
Apr 2, 2020

Conversation

mono0926
Copy link
Contributor

@mono0926 mono0926 commented Mar 14, 2020

iOS resize logic was completely broken after #85 merged.

  • A. Mistakenly shrank excessively and produced image size was smaller one of Android(correct)
  • B. If original image aspect ratio and minWidth/minHeight is same, it won't be resized

You can check iOS/Android resized log at example.

For example CompressFile and rotate 180 was pressed, original log was here:

Android(correct)

src width = 4000.0
src height = 2327.0
width scale = 1.7391304
height scale = 1.5513333
scale = 1.5513333
dst width = 2578.4272
dst height = 1500.0

iOS(broken dst size)

width = 4000
height = 2327
minWidth = 2300
minHeight = 1500
format = 0
scale = 0.38
dst width = 1500.00 // Incorrect
dst height = 873.00 // Incorrect

For B problem, you can check by modifying https://github.com/OpenFlutter/flutter_image_compress/blob/bc8cd9097d6286cef684f21968fbcb6903aa7fa8/example/lib/main.dart#L269-L270 to this(image size is 1036x1024, so aspect ratio is same):

      minWidth: 518,
      minHeight: 512,

@CaiJingLong CaiJingLong merged commit 9aa772d into fluttercandies:master Apr 2, 2020
@CaiJingLong
Copy link
Member

Thx for PR.

@mono0926 mono0926 deleted the fix-broken-ios-resize branch April 2, 2020 03:13
@mono0926
Copy link
Contributor Author

mono0926 commented Apr 3, 2020

@CaiJingLong

Thanks for merging.
Could you release this?
https://pub.dev/packages/flutter_image_compress/versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants