fluttercandies / flutter_image_compress

flutter image compress
MIT License
633 stars 214 forks source link

[Bug report] Image compression causes the contents of the picture to be destroyed #248

Open xiaolei123 opened 1 year ago

xiaolei123 commented 1 year ago

Version

2.0.3

Platforms

Android

Device Model

XIAOMI

flutter info

Flutter (Channel stable, 3.10.4, on macOS 13.4 22F66 darwin-x64, locale
    zh-Hans-CN)
    • Flutter version 3.10.4 on channel stable at /Users/xiaolei/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 682aa387cf (11 days ago), 2023-06-05 18:04:56 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

How to reproduce?

i found a bug , when i use image compress. and this is the image before compress,

this is the image of before compressed and after compressed

https://www.wenshushu.cn/f/bh4t4nsh61v

Logs

No response

Example code (optional)

CompressFormat format;
    if (fileExt.endsWith('jpg') || fileExt.endsWith('jpeg')) {
      format = CompressFormat.jpeg;
    } else if (fileExt.endsWith('png')) {
      format = CompressFormat.png;
    } else if (fileExt.endsWith('heic')) {
      format = CompressFormat.heic;
    } else {
      format = CompressFormat.webp;
    }

    XFile? xfile = await FlutterImageCompress.compressAndGetFile(
      file.path,
      newPath,
      minWidth: width,
      minHeight: height,
      format: format,
      quality: 60,
    );

Contact

No response