GET
/
transform

How to use

The DPI transformation allows you to set the resolution at which PDF and SVG files are rendered when converting them to images.

Pass the following query param to the API endpoint:

dpi=num

Where:

  • num is the desired DPI value.

For example: dpi=300

Parameter

num: The DPI (Dots Per Inch) value to use for rendering. This parameter accepts positive integer values:

  • Higher values result in higher resolution output images.
  • Lower values result in lower resolution output images.
  • Common values include 72 (web standard), 150 (low quality print), 300 (high quality print), and 600 (very high quality print).

Effect of DPI Setting

  • For PDF documents: Determines the resolution at which the PDF pages are rasterized into images.
  • For SVG files: Sets the resolution for converting the vector graphics to raster images.
  • Higher DPI values result in larger file sizes and potentially sharper images, especially when zooming in.
  • Lower DPI values result in smaller file sizes but may lead to loss of detail, especially for text or fine lines.

This transformation is particularly useful when you need to control the quality and file size of images generated from PDF or SVG sources.

Original PDF Document (example)

URL : https://www.thunderimage.com/sample/yosemite.pdf

PDF Rendered at 72 DPI

URL: /transform?url=https://www.thunderimage.com/sample/yosemite.pdf&dpi=72

PDF Rendered at 300 DPI

URL: /transform?url=https://www.thunderimage.com/sample/yosemite.pdf&dpi=300

Best Practices

  • Choose the DPI based on the intended use of the output image:
    • 72-96 DPI is typically sufficient for web display.
    • 300 DPI is standard for high-quality print materials.
    • 600 DPI or higher may be necessary for professional printing or when fine details are crucial.
  • Consider the trade-off between image quality and file size when selecting a DPI value.
  • For web use, lower DPI values (e.g., 72-150) are often sufficient and result in faster loading times.
  • When working with SVGs containing text, higher DPI values may be necessary to ensure legibility.
  • Test different DPI values to find the optimal balance between quality and file size for your specific use case.

Note

The DPI transformation only affects PDF and SVG files. It has no effect on other image formats that already have a fixed pixel resolution.

Authorizations

x-api-key
string
headerrequired

API key required for authentication

Query Parameters

url
string
required

The URL of the PDF or SVG file to be transformed.

dpi
integer

The DPI value to use for rendering. Higher values result in higher resolution output images.

Required range: 1 < x < 1200

Response

200 - image/jpeg

The rendered image in JPEG format.