Skip to content

[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

@m2ahmed-exergy

Description

@m2ahmed-exergy

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions