Free Online Toolbox for developers

Converting images to PDF: Internal structure, resolution, compression, and image quality

Converting images to PDF seems straightforward: select a few images, convert them, and download the resulting document. However, several technical aspects influence the final result, including image formats, resolution, DPI, compression methods, and the internal structure of PDF files.

Understanding these elements helps avoid common problems such as oversized documents, blurry images, unexpected color changes, or unnecessary quality loss.

How the PDF Format Works Internally

PDF (Portable Document Format) is a document format designed to preserve the appearance and layout of content across different devices and operating systems.

Unlike image formats such as JPEG or PNG, a PDF document is not necessarily a single image. It is a structured container that can hold text, vector graphics, fonts, images, metadata, and interactive elements.

A PDF file is organized into several types of objects. These objects reference one another to describe the document’s content and appearance.

The main components include:

  • Header: identifies the PDF version, typically with a declaration such as %PDF-1.7.
  • Objects: contain document elements such as pages, fonts, images, and metadata.
  • Cross-reference table: stores the byte offsets of indirect objects, allowing PDF readers to locate them without scanning the entire file.
  • Trailer: provides information about the document structure, including a reference to the document catalog and the cross-reference table.

A simplified PDF structure looks like this:

%PDF-1.7

1 0 obj
<< /Type /Catalog /Pages 2 0 R >>
endobj

2 0 obj
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
endobj

3 0 obj
<< /Type /Page /Parent 2 0 R
   /MediaBox [0 0 595 842]
   /Resources << /XObject << /Im1 4 0 R >> >>
   /Contents 5 0 R
>>
endobj

4 0 obj
<< /Type /XObject
   /Subtype /Image
   /Width 1200
   /Height 800
   /ColorSpace /DeviceRGB
   /BitsPerComponent 8
   /Filter /DCTDecode
   /Length 12345
>>
stream
... binary image data ...
endstream
endobj

This example illustrates how an image can be embedded in a PDF as an Image XObject. The /Width and /Height entries describe its pixel dimensions, while /ColorSpace and /BitsPerComponent specify its color representation.

The /Filter entry indicates how the image data is encoded. In this example, /DCTDecode is used for JPEG-compressed image data.

PDF files also use content streams to describe how elements are positioned and displayed on a page. An image can therefore be stored once and referenced multiple times with different transformations.

This object-based architecture is one of the reasons PDF is suitable for documents containing a combination of text, images, and vector graphics.

JPEG, HEIC, PNG, and TIFF: Understanding the differences

Before converting images to PDF, it is worth understanding the characteristics of the source formats. They do not all handle compression, transparency, color depth, and image quality in the same way.

FormatCompressionTransparencyTypical Use
JPEG / JPGLossyNoPhotographs
HEICUsually lossy, can also support lossless encodingYesSmartphone photographs
PNGLosslessYesScreenshots, diagrams, graphics
TIFFLossless or lossy, depending on compressionSupportedScanning, printing, archival workflows

JPEG (Joint Photographic Experts Group)

JPEG is a widely supported format designed primarily for photographs. It uses lossy compression, meaning that some image information is discarded to reduce file size.

The compression process relies on transformations such as the Discrete Cosine Transform (DCT), followed by quantization and entropy coding.

The quality setting determines how much information is discarded. A highly compressed JPEG can show visible artifacts, particularly around sharp edges and text.

JPEG is generally a good choice for photographs, especially when file size matters.

HEIC (High Efficiency Image Container)

HEIC is an image container format commonly used by Apple devices. It typically stores images encoded using HEVC (High Efficiency Video Coding).

It can provide better compression efficiency than JPEG at comparable visual quality. HEIC also supports features such as transparency, higher bit depths, and multiple images within a single file.

However, compatibility is not as universal as JPEG. Some applications and document conversion tools may not support HEIC directly.

PNG (Portable Network Graphics)

PNG uses lossless compression based on the DEFLATE algorithm. Unlike JPEG, it preserves the original pixel values without introducing lossy compression artifacts.

It supports transparency through an alpha channel and is particularly suitable for screenshots, diagrams, logos, and images containing text.

However, PNG files can become considerably larger than JPEG files when used for photographs.

TIFF (Tagged Image File Format)

TIFF is a flexible format frequently used in scanning, printing, and image processing workflows.

It supports several compression methods, including LZW, ZIP, and JPEG. Depending on the configuration, TIFF can store lossless or lossy image data.

It also supports different color spaces, high bit depths, and multiple pages in a single file.

TIFF is particularly useful when image fidelity and editing flexibility are more important than file size.

Converting images to PDF: Resolution, DPI, and dimensions

One important aspect of image-to-PDF conversion is the relationship between pixel dimensions and physical dimensions on the page.

An image has a fixed number of pixels, for example 2400 × 1600 pixels. However, its physical size in a PDF depends on the resolution at which those pixels are displayed.

This is where DPI (Dots Per Inch) comes into play.

For example, a 2400-pixel-wide image displayed at 300 DPI has a physical width of:

2400 / 300 = 8 inches

At 150 DPI, the same image would be displayed at:

2400 / 150 = 16 inches

The image itself has not changed. Only its physical dimensions have changed.

It is important to distinguish DPI from PPI (Pixels Per Inch). PPI describes the density of image pixels, whereas DPI technically refers to the number of printer dots per inch. The terms are often used interchangeably in image conversion tools, although they do not describe exactly the same thing.

For a typical document:

  • 72 DPI can be sufficient for basic screen viewing, depending on the display size.
  • 150 DPI is often a reasonable compromise for documents that may be printed.
  • 300 DPI is commonly used for high-quality printing and detailed scans.

These are practical guidelines rather than strict requirements. The appropriate resolution depends on the content, intended viewing size, and printing requirements.

Upscaling an image does not recreate missing details. For example, converting a 600 × 400 image to 300 DPI does not magically produce the same quality as an original 2400 × 1600 image.

A conversion tool should therefore preserve the original pixel dimensions unless resizing is explicitly required.

PDF image compression and file size optimization

Embedding images in a PDF can significantly increase the document’s size. A document containing ten high-resolution photographs may easily reach several dozen megabytes.

The compression method used during conversion has a direct impact on the resulting file size and visual quality.

There are two main approaches:

Lossy compression

JPEG compression reduces file size by discarding image information. Increasing compression generally produces smaller files but introduces more visible artifacts.

This approach is often suitable for photographs, where a moderate reduction in quality may not be noticeable.

Lossless compression

Lossless methods preserve the original image data. ZIP/Flate compression is commonly used in PDF files, while other methods such as CCITT and JPEG 2000 are also supported in specific contexts.

Lossless compression is particularly useful for screenshots, diagrams, and images containing sharp edges or text.

A few practical optimization techniques include:

  • Resizing images to match their intended display dimensions instead of embedding unnecessarily large originals.
  • Choosing an appropriate JPEG quality setting for photographs.
  • Avoiding repeated JPEG compression, which can progressively degrade image quality.
  • Using lossless compression for screenshots and diagrams.
  • Removing unnecessary metadata when it is not required.
  • Checking the final PDF size before sharing or uploading it.

Compression should always be balanced against the intended use of the document. A PDF intended for archival purposes may require different settings from one designed to be sent by email.

How to convert images to PDF

The conversion process generally consists of decoding the source image, creating a PDF page, embedding the image data, and defining its position and dimensions.

For example, a conversion tool may follow these steps:

  1. Read the source image and identify its format.
  2. Decode the image into pixels, taking into account its color space and orientation.
  3. Calculate the dimensions required to fit the image onto the PDF page.
  4. Apply resizing or compression if necessary.
  5. Create an Image XObject containing the image data.
  6. Add the image reference to the page resources.
  7. Generate the PDF objects, cross-reference information, and trailer.

When converting several images, the process is repeated for each image, generally creating one PDF page per image.

Page dimensions also matter. A portrait photograph may fit naturally on an A4 page, while a landscape image may require rotation or scaling.

The conversion tool should preserve the aspect ratio to avoid distorting the original image.

If you want to convert images without installing software, Adobe provides an online JPG to PDF converter.

Common problems when converting images to PDF

Even though the conversion process seems straightforward, a few issues can affect the resulting document.

Blurry images

This can happen when the conversion tool resizes images to a lower resolution or applies excessive compression. Always check the output at the intended display or printing size.

Unexpected file sizes

A PDF containing several uncompressed, high-resolution images can become very large. Resizing images and choosing appropriate compression settings can help reduce its size.

Incorrect image orientation

Some photographs contain EXIF orientation metadata rather than physically rotated pixel data. A converter that ignores this metadata may display images sideways or upside down.

Color differences

Different color profiles and color spaces can produce variations between the original image and the PDF. Color management is particularly important for professional printing workflows.

Transparency issues

PNG images can contain transparent areas. Depending on how the PDF is generated, these areas may be preserved using an appropriate transparency mechanism or rendered against a background.

HEIC compatibility

Not all PDF conversion tools support HEIC directly. In some cases, the image must first be decoded and converted into another format before being embedded in the PDF.

Conclusion

Converting images to PDF involves more than simply changing a file extension. The PDF structure, image encoding, resolution, physical dimensions, compression method, and color management all influence the final document.

Understanding these technical aspects makes it easier to choose the right image format and conversion settings, whether the goal is to produce a lightweight document for email, a high-quality PDF for printing, or an archive that preserves image details.

The best conversion settings ultimately depend on how the PDF will be used. There is no single combination of resolution and compression that works for every situation.




Suggested Reads