Commit f6b13fcc05d3d1367a03d54e83fe0605366e49fd

Authored by Connor Osborn
1 parent 8de2497a

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.
qpdf/qtest/image-optimization.test
... ... @@ -33,6 +33,8 @@ my @image_opt = (
33 33 ['large-inline-image', 'inline-images-keep-all', '--keep-inline-images'],
34 34 ['unsupported-optimization', 'unsupported',
35 35 '--oi-min-width=0 --oi-min-height=0 --oi-min-area=0'],
  36 + ['nested-images', 'nested-images',
  37 + '--oi-min-width=0 --oi-min-height=0 --oi-min-area=0']
36 38 );
37 39  
38 40 my $n_tests = 2 * scalar(@image_opt);
... ...
qpdf/qtest/qpdf/nested-images.pdf 0 โ†’ 100644
No preview for this file type
qpdf/qtest/qpdf/optimize-images-nested-images-json.out 0 โ†’ 100644
  1 +{
  2 + "version": 2,
  3 + "parameters": {
  4 + "decodelevel": "generalized"
  5 + },
  6 + "pages": [
  7 + {
  8 + "contents": [
  9 + "4 0 R"
  10 + ],
  11 + "images": [],
  12 + "label": null,
  13 + "object": "3 0 R",
  14 + "outlines": [],
  15 + "pageposfrom1": 1
  16 + }
  17 + ]
  18 +}
... ...
qpdf/qtest/qpdf/optimize-images-nested-images.out 0 โ†’ 100644
  1 +qpdf: image /X1 on page 1: optimizing image reduces size from 2628 to ...
  2 +qpdf: wrote file a.pdf
... ...