PDF Compression by Re-encoding Images

After reading this you will know why re-encoding a PDF's images shrinks the file, how JPEG quality and resolution trade size against clarity, and when this method saves megabytes versus when it wrecks a document.

A PDF that started as a phone photo of a receipt can weigh 8 MB. The same page, readable at arm's length, can fit in 200 KB. That 40:1 gap is not magic. It is the difference between the storage-hungry way a scanner or camera writes pixels and a tuned JPEG. This tool closes that gap by rendering each page to a bitmap and writing it back as a compressed JPEG at a resolution and quality you pick.

What this tool actually does to your file

A PDF is a container. Inside it are objects: text drawn from embedded fonts, vector paths, and image data. When you scan a document, the scanner usually stores each page as one large image object, often lightly compressed or not compressed at all. That image is the weight.

This tool takes each page, draws it onto a canvas at a chosen pixel density, then encodes that canvas as a JPEG. The JPEG replaces whatever was on the page before. The result is a new PDF where every page is a single image.

Rasterizing turns selectable text into pixels. After compression you cannot copy, search, or reflow the text. Use this on scans and image-heavy handouts, not on contracts or papers where the text layer matters.

Where the bytes go: JPEG in one paragraph

JPEG shrinks an image in three moves. It splits the image into 8×8 pixel blocks. It runs each block through a discrete cosine transform, which describes the block as a sum of wave patterns from smooth to sharp. Then it divides those wave coefficients by a quantization table and rounds to whole numbers. The rounding is where data is thrown away. High quality uses a gentle table, so little rounding. Low quality uses an aggressive table, so many coefficients round to zero and vanish. Zeros compress to almost nothing, which is why a low-quality JPEG is small.

This is lossy. Once a coefficient rounds to zero it is gone. Re-encoding an already-compressed JPEG at the same quality still loses a little more each time, because the block grid and rounding never line up perfectly.

The size estimate and its two knobs

Two settings control the output size: the resolution you render at and the JPEG quality. Resolution acts on the pixel count, and pixel count grows with the square of the linear scale.

\text{pixels} = w_{in} \cdot h_{in} \cdot \text{dpi}^2

Here w_{in} and h_{in} are the page width and height in inches, and dpi is dots per inch. A US Letter page is 8.5 \times 11 inches. At 150 dpi that is 1275 \times 1650 = 2{,}103{,}750 pixels. Drop to 100 dpi and it is 850 \times 1100 = 935{,}000 pixels, about 44% as many. Halving the dpi quarters the pixels, because both dimensions shrink.

A rough size model for the encoded page is pixels times a per-pixel cost that falls as quality falls:

\text{bytes} \approx \text{pixels} \times b(q)

Where b(q) is bytes per pixel at quality q. For typical scanned text, b(0.9) \approx 0.5, b(0.7) \approx 0.15, and b(0.4) \approx 0.06. These are ballpark figures; a busy photo costs more per pixel than a page of black text on white, because the photo has more non-zero coefficients to store.

The tool shows the true before and after size after it encodes, so you never rely on this estimate to decide. The formula is here so you can predict roughly what a setting will do before you click.

Worked example with the demo defaults

A 10-page scanned Letter document at default settings

Suppose you load a 10-page scan. Each page was captured at 300 dpi with light compression, weighing about 1.5 MB, so the file is roughly 15 MB. The defaults render at 150 dpi and quality 0.7.

  1. Pixel count per page at 150 dpi: 1275 \times 1650 = 2{,}103{,}750 pixels.
  2. Bytes per page at quality 0.7: 2{,}103{,}750 \times 0.15 \approx 315{,}560 bytes, about 308 KB.
  3. Ten pages: 10 \times 308 = 3{,}080 KB, about 3.0 MB.
  4. Compression ratio: 15 / 3.0 = 5.0, so the file is one fifth its original size.

The scan started at 300 dpi. Dropping to 150 dpi already cut the pixel count to one quarter. The quality drop from near-lossless to 0.7 did the rest. Text stays sharp on screen and prints cleanly at normal reading size.

Both knobs matter. Cutting dpi from 300 to 150 shrinks the file even at high quality, then lowering quality shrinks it further.

Try the trade-off yourself

As you lower JPEG quality, file size falls fast at first then levels off, while visible blocking artifacts grow. At 150 dpi and quality 0.7 a Letter page is about 308 KB; at quality 0.4 it drops to about 126 KB but 8×8 block edges start to show on smooth gradients and small text.

When to use it and when not to

Use this tool when the weight is images: scanned pages, photo-heavy reports, screenshots exported to PDF, or handouts someone scanned at 600 dpi. These files respond well because their bulk is exactly the thing JPEG compresses.

Do not use it on three kinds of file. First, text-only PDFs generated from a word processor are already small, often under 100 KB per page, and rasterizing them makes them larger and unsearchable. Second, documents you must keep editable or searchable, since the text layer is destroyed. Third, line art, diagrams, and CAD drawings, where JPEG's block rounding smears crisp edges into gray fuzz. For sharp line art you want PNG, not JPEG.

Check the page count and the before size first. If the file is 40 pages and 900 KB, it is already text and compression will not help. If it is 4 pages and 20 MB, it is photos or scans and you can save a lot.

Reading the before and after numbers

The tool reports the original size and the new size. The number that matters is the ratio, not the difference. A file that goes from 15 MB to 3 MB has a ratio of 5.0. A file that goes from 900 KB to 850 KB has a ratio of 1.06, which means it was already compressed and you gained almost nothing.

What different before/after outcomes tell you
BeforeAfterRatioReading
15 MB3.0 MB5.0Heavy scan, big win
8 MB1.2 MB6.7High-dpi photo pages
1.2 MB1.1 MB1.09Already compressed, skip
300 KB480 KB0.63Text PDF, made it worse

A ratio below 1.0 means the output is larger than the input. That happens when the source was vector text and you converted it to images. If you see that, undo the plan: this file did not need compression.

Common mistakes

The most frequent error is compressing a file that was already small, then being surprised the text no longer highlights. Rasterizing always removes the text layer. The second is picking a resolution too low for the use. At 72 dpi a Letter page is only 612 \times 792 pixels, fine for screen thumbnails but blurry when printed. Match the dpi to the destination: 100 to 150 for screen reading, 200 to 300 for printing.

A third mistake is chasing the smallest possible size. The size curve flattens below quality 0.5, so going from 0.5 to 0.3 saves little but adds obvious blocky artifacts around text. Stop where the file is small enough and the text is still clean, usually between 0.6 and 0.8.

Related tools

Compression is often the last step in a longer cleanup. If you need to combine several scans first, use the PDF Merger, then compress the result. To pull apart a large scan before compressing only the heavy pages, use the PDF Splitter or the PDF Page Extractor. If pages came out sideways from a scanner, fix them with the PDF Rotator before rasterizing, since rotation after compression re-encodes again.

When you want the raw images rather than a PDF, the PDF → Images tool renders each page to PNG or JPEG, and Images → PDF goes the other way. To check what hidden author and software fields a file carries before you share it, use the PDF Metadata Viewer & Stripper.

Frequently asked questions

Why did my PDF get bigger after compression?

Your file was already vector text, which is tiny. Rasterizing each page to a JPEG replaced compact text with a full-page image, and the image is heavier. Compression only helps files whose bulk is images.

Will the text still be searchable?

No. This method draws every page as a picture, so text becomes pixels. Searching, copying, and screen readers all stop working on the text. Keep an original copy if you need the text layer.

What quality should I choose?

Start at 0.7. It removes most of the file weight while keeping text and photos clean. Drop toward 0.5 only if you need the file smaller and the pages are still readable. Below 0.4 you will see 8×8 blocking around edges.

What dpi is right for printing?

Use 200 to 300 dpi for print. At 150 dpi a page prints acceptably for internal use but looks soft up close. For screen-only reading, 100 to 150 dpi is enough and much smaller.

Does my file get uploaded anywhere?

No. The rendering and JPEG encoding run entirely in your browser. The PDF never leaves your device, so you can compress private documents without sending them to a server.