coherentgraphics / cpdf-binaries

PDF Command Line Tools binaries for Linux, Mac, Windows
GNU Affero General Public License v3.0
591 stars 42 forks source link

The "-image-resolution-json [dpi]" operation lists all images found in the pdf regardless of dpi #91

Open d-ph opened 1 month ago

d-ph commented 1 month ago

Hello,

It appears that in contrast to the "-image-resolution" operation, "-image-resolution-json" lists all images found in a given pdf regardless of the dpi. Would it be possible to shed some light on this, please?

Example:

cli: cpdf -image-resolution 100 test_file.pdf
output: [none]
cli: cpdf -image-resolution-json 100 test_file.pdf
output:
[
  {
    "Object": 17,
    "Page": 1,
    "XObject": "/Im0",
    "W": 1131,
    "H": 1600,
    "Xdpi": 136.7970694463346,
    "Ydpi": 136.8349914440121
  },
  {
    "Object": 17,
    "Page": 2,
    "XObject": "/Im0",
    "W": 1131,
    "H": 1600,
    "Xdpi": 136.7970694463346,
    "Ydpi": 136.8349914440121
  }
]
cli: cpdf -version
cpdf AGPL Version 2.7.1 (24th July 2024)

Thanks.

johnwhitington commented 1 month ago

This doesn't sound right. Can you supply an example file, please?

d-ph commented 1 month ago

Not the file I used. However, it appears to apply to any pdf. Please see the following pdf.

Almshouse_at_Petworth.pdf

$ cpdf -image-resolution 50 Almshouse_at_Petworth.pdf
output: [none]
$ cpdf -image-resolution-json 50 Almshouse_at_Petworth.pdf
output: 
[
  {
    "Object": 8,
    "Page": 1,
    "XObject": "/Im0",
    "W": 682,
    "H": 720,
    "Xdpi": 72.0,
    "Ydpi": 72.0
  }
]
johnwhitington commented 3 weeks ago

Confirmed. Thanks. Will fix.