Skip to content

Bug: make the tiff encoder spec conformant to avoid corrupted TIFF on MacOS #708

@stephane-archer

Description

@stephane-archer

This image is 3840 × 2160:
testHorizontal.zip

The copyResize function silently produces corrupted TIFF output when resizing an image to a height that is not a multiple of the original height (e.g., 1234). However, it works correctly for heights like 720 or 1024.

    var resizeImage = img.copyResize(refImageCompatibleImage, height: 1234);
    img.Image editedImage = img.adjustColor(
      resizeImage,
      brightness: brightness,
    );
    Uint8List editedImageEncoded = img.encodeTiff(editedImage);
    File editedImageFile = await getNewTempFile("EditedImage", ".tiff");
    await editedImageFile.create(exclusive: true);
    await editedImageFile.writeAsBytes(editedImageEncoded);
    return editedImageFile.path;

Issues

  • Silent Failure: The function does not throw an error for unsupported heights.
  • Unexpected Behavior: The function should resize to any height, or document constraints and enforce them via exceptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions