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] Rendered exported image produced from iPhone with white background is not completely white after export. Its become smokey white. For example for pure white(FFFFFF), rendered export image is produced as smokey white(FAFAFA). This is only occuring in iOS-iPhone platforms. #136

Open
m2ahmed-exergy opened this issue Jun 3, 2024 · 1 comment

Comments

@m2ahmed-exergy
Copy link

Version

1.5.0

Platforms

iOS

Device Model

iPhone 12 Pro Max

flutter info

Flutter version i am using 3.19.6

How to reproduce?

var rootMergeContainer = ImageMergeOption(
canvasSize: Size(exportWidth.toDouble(), exportHeight.toDouble()),
format: OutputFormat.jpeg(80),
);

    ByteData exportBackgroundData;
    exportBackgroundData = await rootBundle.load(
        "assets/drawable/photobook_layouts/ic_photobook_text_white_bg.jpg");
    Uint8List exportBG = exportBackgroundData.buffer.asUint8List();
    rootMergeContainer.addImage(MergeImageConfig(
        image: MemoryImageSource(exportBG),
        position:
            ImagePosition(Offset(0, 0), Size(2400, 2400))));
    Uint8List centerCropSrcUInt8List;

rootMergeContainer.addImage(MergeImageConfig(
image: MemoryImageSource(exportBG),
position: ImagePosition(
Offset(100,
200),
2200,
2200))));

    Uint8List? result = await ImageMerger.mergeToMemory(
      option: rootMergeContainer,
    );
    MemoryImage? provider = MemoryImage(result!);
    Uint8List originalBytes = provider.bytes;
    Uint8List resultBytes = Uint8List.fromList(originalBytes);
    resultBytes[13] = 1;
    resultBytes[14] = (300 >> 8);
    resultBytes[15] = (300 & 0xff);
    resultBytes[16] = (300 >> 8);
    resultBytes[17] = (300 & 0xff);

    String tempPath = await Utilities.getAppDirectoryPath(
        isPlatformAndroid: Platform.isAndroid,
        isPlatformIOS: Platform.isIOS);
    File? file;
    if (Platform.isAndroid) {
      String imgName = "IMG_AND_COLOR_TILES_" +
          DateTime.now().millisecondsSinceEpoch.toString() +
          JPEG_EXTENSION;
      print(imgName);
      file = File('$tempPath/$imgName');
    } else if (Platform.isIOS) {
      String imgName = "IMG_IOS_COLOR_TILES_" +
          DateTime.now().millisecondsSinceEpoch.toString() +
          JPEG_EXTENSION;
      print(imgName);
      file = File('$tempPath/$imgName');
    }
    file?.writeAsBytesSync(resultBytes.bytes);

page-1-image-411716467202813

Logs

No response

Example code (optional)

No response

Contact

No response

@m2ahmed-exergy
Copy link
Author

Further more i have diagnosed that this issue is being produced from version 1.4.0 and onwards.

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

No branches or pull requests

1 participant