diff options
author | Connor Osborn <connor@cdosborn.com> | 2023-03-13 21:38:49 +0100 |
---|---|---|
committer | Connor Osborn <connor@cdosborn.com> | 2023-03-16 04:27:05 +0100 |
commit | f6b13fcc05d3d1367a03d54e83fe0605366e49fd (patch) | |
tree | 2fe9846a5c77e6f36671e2dd83ef5fe74f29648e | |
parent | 8de2497a8fcfc659e9d0927aadd44ac4ee1f0d18 (diff) | |
download | qpdf-f6b13fcc05d3d1367a03d54e83fe0605366e49fd.tar.zst |
Add test validating that images in nested XObjects are included in optimization
The sample file (nested-images.pdf) includes a pdf with an image that is
nested within an XObject within an XObject in the Resources dict of the
only page. These images were ignored in prior versions of qpdf.
-rw-r--r-- | qpdf/qtest/image-optimization.test | 2 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/nested-images.pdf | bin | 0 -> 5744 bytes | |||
-rw-r--r-- | qpdf/qtest/qpdf/optimize-images-nested-images-json.out | 18 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/optimize-images-nested-images.out | 2 |
4 files changed, 22 insertions, 0 deletions
diff --git a/qpdf/qtest/image-optimization.test b/qpdf/qtest/image-optimization.test index 1b3901e6..10ffd526 100644 --- a/qpdf/qtest/image-optimization.test +++ b/qpdf/qtest/image-optimization.test @@ -33,6 +33,8 @@ my @image_opt = ( ['large-inline-image', 'inline-images-keep-all', '--keep-inline-images'], ['unsupported-optimization', 'unsupported', '--oi-min-width=0 --oi-min-height=0 --oi-min-area=0'], + ['nested-images', 'nested-images', + '--oi-min-width=0 --oi-min-height=0 --oi-min-area=0'] ); my $n_tests = 2 * scalar(@image_opt); diff --git a/qpdf/qtest/qpdf/nested-images.pdf b/qpdf/qtest/qpdf/nested-images.pdf Binary files differnew file mode 100644 index 00000000..cb2b4d87 --- /dev/null +++ b/qpdf/qtest/qpdf/nested-images.pdf diff --git a/qpdf/qtest/qpdf/optimize-images-nested-images-json.out b/qpdf/qtest/qpdf/optimize-images-nested-images-json.out new file mode 100644 index 00000000..9f713aa7 --- /dev/null +++ b/qpdf/qtest/qpdf/optimize-images-nested-images-json.out @@ -0,0 +1,18 @@ +{ + "version": 2, + "parameters": { + "decodelevel": "generalized" + }, + "pages": [ + { + "contents": [ + "4 0 R" + ], + "images": [], + "label": null, + "object": "3 0 R", + "outlines": [], + "pageposfrom1": 1 + } + ] +} diff --git a/qpdf/qtest/qpdf/optimize-images-nested-images.out b/qpdf/qtest/qpdf/optimize-images-nested-images.out new file mode 100644 index 00000000..253a9208 --- /dev/null +++ b/qpdf/qtest/qpdf/optimize-images-nested-images.out @@ -0,0 +1,2 @@ +qpdf: image /X1 on page 1: optimizing image reduces size from 2628 to ... +qpdf: wrote file a.pdf |