Skip to content

Vipsthumbnail PDF resize issue when using dpi as option and preventing upscaling #1824

@le0daniel

Description

@le0daniel

Describe the bug
When using vipsthumbnail to resize a pdf with the DPI option and preventing upscaling using > as following:
vipsthumbnail input.pdf[dpi=150] --size 2400x\> -o converted.png[strip]
The upscaling uses the width and height of the PDF without consideration of the DPI (so using the default dpi of 72). This results in images with much lower quality and the wrong dimensions.

To Reproduce

  1. Run following command with and without dpi=150. Results in same dimensions of (595  ×  842).
    vipsthumbnail input.pdf[dpi=150] --size 2400x\> -o converted.png[strip]
  2. Run the command with and without --dpi=150. The dimensions are (1240 x  1754) with dpi option and (595  ×  842) without dpi option
    vips pdfload input.pdf --dpi=150 converted.png

Expected behavior
Respect the DPI given by the load options when preventing upscaling

Actual behavior
Uses the default PDF DPI of 72 to prevent upscaling.

Screenshots
Example with DPI=150 using vipsthumbnail and > to prevent upscaling. Image dimensions (595  ×  842)
converted

Example without DPI=150 using vipsthumbnail and > to prevent upscaling. Image dimensions (595  ×  842)
converted-2

Sample when using pdfload to convert to png with DPI = 150, Results in dimensions of (1240 x  1754)
sample1

Sample when using pdfload to convert to png with default DPI = 72, Results in dimensions of (595 × 842)
sample2

Environment

  • OS: MacOS 10.15.5
  • Vips: 8.10.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions