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

[Bug report] Inconsistent resizing behavior between iOS and Android in thumbnailDataWithSize #1271

Open
choi88andys opened this issue Mar 6, 2025 · 1 comment

Comments

@choi88andys
Copy link

Version

3.6.4

Platforms

iOS, Android

Device Model

iPhone 13(iOS 18.0), Android emulator API 30

flutter info

[✓] Flutter (Channel stable, 3.27.1, on macOS 15.3.1 24D70 darwin-arm64, locale ko-KR)
    • Flutter version 3.27.1 on channel stable at ...
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (3 months ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at ...
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode-15.4.0.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)

[✓] VS Code (version 1.97.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.106.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 15.3.1 24D70 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 15.3.1 24D70 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 133.0.6943.142

[✓] Network resources
    • All expected network resources are available.

• No issues found!

How to reproduce?

Steps to reproduce

  • Load an image with dimensions 1000x2000.
  • Call thumbnailDataWithSize(200) to resize the image.
  • Compare the result on iOS and Android.

Description

I've encountered an issue where resizing images using the thumbnailDataWithSize method produces inconsistent results on iOS and Android.
The image should be resized proportionally, maintaining the same aspect ratio across both platforms.

For example, resizing an image of size 1000x2000 with a target size of 200 should result in 200x400.
On Android, the image is correctly resized to 200x400, which is the expected result. However, on iOS, the image is resized to 100x200.

This suggests that Android scales the smaller dimension to 200, whereas iOS scales the larger dimension to 200.

Could you clarify if this behavior is intentional or if it's a bug?

Logs

Example code (optional)

// I tested using package image
import 'package:image/image.dart' as img;

final thumbnail = await asset.thumbnailDataWithSize(
  const ThumbnailSize(200, 200),
);

final image = img.decodeImage(thumbnail!)!;
print('image.width: ${image.width}');
print('image.width: ${image.height}');

Contact

No response

@fluttercandies-dev
Copy link

AI Summary: The thumbnailDataWithSize method returns inconsistent image dimensions on iOS and Android. On iOS, the larger dimension is scaled to the target size, while Android scales the smaller dimension.

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

No branches or pull requests

2 participants