From 6124b900d9507687c21e43e68f495bbee9d8d45b Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 19 Dec 2019 14:10:54 +0100 Subject: Add support for reading BigTIFF All recent versions of libtiff has support for the 64bit-indexed BigTIFF format. Allow reading it by recognizing its magic number. [ChangeLog][TIFF] Add support for reading BigTIFF Fixes: QTBUG-80538 Change-Id: I7fcb72d77e4a0bdcb38ab96e9f6cfaff7cf4ad49 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/tiff/tst_qtiff.cpp | 29 ++++++++++++++++++++++++ tests/shared/images/tiff.qrc | 4 ++++ tests/shared/images/tiff/big_16bpc.tiff | Bin 0 -> 21548 bytes tests/shared/images/tiff/big_grayscale.tiff | Bin 0 -> 4581 bytes tests/shared/images/tiff/big_rgb.tiff | Bin 0 -> 12748 bytes tests/shared/images/tiff/big_rgb_bigendian.tiff | Bin 0 -> 12748 bytes 6 files changed, 33 insertions(+) create mode 100644 tests/shared/images/tiff/big_16bpc.tiff create mode 100644 tests/shared/images/tiff/big_grayscale.tiff create mode 100644 tests/shared/images/tiff/big_rgb.tiff create mode 100644 tests/shared/images/tiff/big_rgb_bigendian.tiff (limited to 'tests') diff --git a/tests/auto/tiff/tst_qtiff.cpp b/tests/auto/tiff/tst_qtiff.cpp index be02460..e411f66 100644 --- a/tests/auto/tiff/tst_qtiff.cpp +++ b/tests/auto/tiff/tst_qtiff.cpp @@ -90,6 +90,9 @@ private slots: void colorSpace_data(); void colorSpace(); + void bigtiff_data(); + void bigtiff(); + private: QString prefix; }; @@ -173,6 +176,10 @@ void tst_qtiff::readImage_data() QTest::newRow("tiled_oddsize_mono") << QString("tiled_oddsize_mono.tiff") << QSize(59, 71); QTest::newRow("16bpc") << QString("16bpc.tiff") << QSize(64, 46); QTest::newRow("gray16") << QString("gray16.tiff") << QSize(64, 46); + QTest::newRow("big_rgb") << QString("big_rgb.tiff") << QSize(64, 64); + QTest::newRow("big_rgb_bigendian") << QString("big_rgb_bigendian.tiff") << QSize(64, 64); + QTest::newRow("big_grayscale") << QString("big_grayscale.tiff") << QSize(64, 64); + QTest::newRow("big_16bpc") << QString("big_16bpc.tiff") << QSize(64, 46); } void tst_qtiff::readImage() @@ -665,5 +672,27 @@ void tst_qtiff::colorSpace() QCOMPARE(image2, image); } +void tst_qtiff::bigtiff_data() +{ + QTest::addColumn("expectedFile"); + QTest::addColumn("bigtiffFile"); + + QTest::newRow("big_rgb") << QString("original_rgb.tiff") << QString("big_rgb.tiff"); + QTest::newRow("big_rgb_bigendian") << QString("original_rgb.tiff") << QString("big_rgb_bigendian.tiff"); + QTest::newRow("big_grayscale") << QString("original_grayscale.tiff") << QString("big_grayscale.tiff"); + QTest::newRow("big_16bpc") << QString("16bpc.tiff") << QString("big_16bpc.tiff"); +} + +void tst_qtiff::bigtiff() +{ + QFETCH(QString, expectedFile); + QFETCH(QString, bigtiffFile); + + QImage expectedImage(prefix + expectedFile); + QImage bigtiffImage(prefix + bigtiffFile); + QVERIFY(!bigtiffImage.isNull()); + QCOMPARE(expectedImage, bigtiffImage); +} + QTEST_MAIN(tst_qtiff) #include "tst_qtiff.moc" diff --git a/tests/shared/images/tiff.qrc b/tests/shared/images/tiff.qrc index e1ce9da..2c876af 100644 --- a/tests/shared/images/tiff.qrc +++ b/tests/shared/images/tiff.qrc @@ -52,5 +52,9 @@ tiff/oddsize_mono.tiff tiff/tiled_rgb.tiff tiff/gray16.tiff + tiff/big_rgb.tiff + tiff/big_16bpc.tiff + tiff/big_grayscale.tiff + tiff/big_rgb_bigendian.tiff diff --git a/tests/shared/images/tiff/big_16bpc.tiff b/tests/shared/images/tiff/big_16bpc.tiff new file mode 100644 index 0000000..09f949c Binary files /dev/null and b/tests/shared/images/tiff/big_16bpc.tiff differ diff --git a/tests/shared/images/tiff/big_grayscale.tiff b/tests/shared/images/tiff/big_grayscale.tiff new file mode 100644 index 0000000..244f8fc Binary files /dev/null and b/tests/shared/images/tiff/big_grayscale.tiff differ diff --git a/tests/shared/images/tiff/big_rgb.tiff b/tests/shared/images/tiff/big_rgb.tiff new file mode 100644 index 0000000..18eecf2 Binary files /dev/null and b/tests/shared/images/tiff/big_rgb.tiff differ diff --git a/tests/shared/images/tiff/big_rgb_bigendian.tiff b/tests/shared/images/tiff/big_rgb_bigendian.tiff new file mode 100644 index 0000000..0d1a11f Binary files /dev/null and b/tests/shared/images/tiff/big_rgb_bigendian.tiff differ -- cgit v1.2.1