-
-
Notifications
You must be signed in to change notification settings - Fork 272
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: make the tiff encoder spec conformant to avoid corrupted TIFF on MacOS #708
Comments
I'm not seeing the error or corruption from copyResize. I ran a test on your image using final img =
decodeJpg(File('test/_data/jpg/testHorizontal.jpg').readAsBytesSync())!;
final i0 = copyResize(img, height: 1234);
final editedImage = adjustColor(
i0,
brightness: 0.75,
);
expect(i0.width, equals(2194));
expect(i0.height, equals(1234));
File('$testOutputPath/transform/copyResize_jpg.tif')
..createSync(recursive: true)
..writeAsBytesSync(encodeTiff(editedImage));
}); And that produced this TIFF, |
@brendan-duncan the tiff produced that you linked can't be read in MacOS and result in error when displaying using flutter |
I don't know what makes this tiff incompatible with MacOS, is there anything special with that tiff? Could it be an error in the files or a structure issue in the file? Bit Depth? Color Profile? Metadata? |
there seems to be error in the produced file:
|
|
The last point is most likely the main issue and could explain why some resolutions work for |
I'll take a look at the TIFF encoder on macOS as soon as I get a chance. TIFF is such an awful format. It can do everything, but the problem is that it can do everything and no one can agree on what it should do. |
According to libtiff, http://www.simplesystems.org/libtiff/functions/TIFFtile.html, tileWidth and tileHeight have to be a multiple of 16 to be spec conformant. I'll look into making that happen. |
copyResize
Produces Corrupted Output for Arbitrary Heights
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.
Issues
The text was updated successfully, but these errors were encountered: