mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:17:34 +00:00
LibGfx/TIFF: Accept images with a single strip and no RowsPerStrip tag
This tag is required by the specification, but some encoders (at least Krita) don't write it for images with a single strip. The test file was generated by opening deflate.tiff in Krita and saving it with the DEFLATE compression.
This commit is contained in:
parent
284e785053
commit
c2c7365494
4 changed files with 20 additions and 4 deletions
|
@ -591,6 +591,18 @@ TEST_CASE(test_tiff_deflate)
|
|||
EXPECT_EQ(frame.image->get_pixel(60, 75), Gfx::Color::NamedColor::Red);
|
||||
}
|
||||
|
||||
TEST_CASE(test_tiff_krita)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("tiff/krita.tif"sv)));
|
||||
EXPECT(Gfx::TIFFImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::TIFFImageDecoderPlugin::create(file->bytes()));
|
||||
|
||||
auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 400, 300 }));
|
||||
|
||||
EXPECT_EQ(frame.image->get_pixel(0, 0), Gfx::Color::NamedColor::White);
|
||||
EXPECT_EQ(frame.image->get_pixel(60, 75), Gfx::Color::NamedColor::Red);
|
||||
}
|
||||
|
||||
TEST_CASE(test_tiff_orientation)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("tiff/orientation.tiff"sv)));
|
||||
|
|
BIN
Tests/LibGfx/test-inputs/tiff/krita.tif
Normal file
BIN
Tests/LibGfx/test-inputs/tiff/krita.tif
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue