PDF to JPG versus PNG: measured quality and file-size test
We exported the same three-page PDF as JPG and PNG in Chrome. Every page had identical pixel dimensions, while compression cost varied sharply with photo, interface, and flat-graphic content.
Controlled test result
PNG was 4.28 times larger overall; JPG changed rendered pixels
Fixture and reproducible method
The 907,216-byte source PDF has three Letter pages. Page one contains a generated photo-style landscape; page two contains a small-text interface screenshot; page three contains a flat-color graphic with thin rules and labels. Each page also has vector heading and footer text, so the source includes both embedded raster material and PDF text.
- Generate the source with
scripts/evidence/generate_fixtures.py. - Load the current Converttwo application in Chrome 152.0.7977.83.
- Call the exported
pdfToImagesfunction through the served application once for JPG and once for PNG. - Inspect both ZIP archives, decode every image, and compare corresponding JPG and PNG pixels.
Both conversions used PDF.js scale 2. Letter pages measuring 612 x 792 PDF points therefore became 1224 x 1584 pixels. JPG used browser JPEG quality 0.9. PNG encoded the same rendered canvas losslessly. Both paths rasterize text and vectors; neither output retains searchable PDF text.
Photo content produced the largest file-size difference
The photo PNG was 7.64 times the JPG size. Against the PNG rendering, the JPG had a mean absolute channel difference of 0.590 and a maximum channel difference of 64 on a 0-255 scale. At normal page-preview size the pair looked very similar, but JPG introduced measurable changes around textured and high-contrast regions.
PNG’s size penalty was smaller on the interface page
The PNG was 1.74 times the JPG size on this mostly white page. The JPG differed on 14.22% of pixels, with a mean absolute channel difference of 0.182. Thin text and rules remained readable in this controlled export, but PNG retained the rendered pixel values exactly and avoids adding JPEG ringing around sharp boundaries.
Measured results by content type
| PDF page | JPG bytes | PNG bytes | PNG/JPG ratio | JPG changed pixels | Mean channel difference |
|---|---|---|---|---|---|
| 1: photo-style image | 104,517 | 798,826 | 7.64x | 37.46% | 0.590 |
| 2: small-text interface | 66,367 | 115,666 | 1.74x | 14.22% | 0.182 |
| 3: flat-color graphic | 64,672 | 94,043 | 1.45x | 40.49% | 0.406 |
| Whole ZIP | 235,968 | 1,008,947 | 4.28x | Three 1224 x 1584 images in each archive | |
“Changed pixels” counts any nonzero RGB difference between a decoded JPG and the corresponding PNG. It does not mean that every changed pixel is visibly objectionable. The mean channel difference helps show that most changes were small even where many pixels differed.
Which output should you choose?
Choose JPG when smaller downloads matter and pages are dominated by photographs, gradients, or ordinary scans. Choose PNG when text, one-pixel rules, diagrams, or repeated image editing make lossless rendered pixels more valuable than storage. For this fixture, PNG’s relative penalty was much larger on the photograph than on either designed page.
These results apply to this three-page fixture, Chrome 152, the current PDF.js rendering path, and the current quality settings. Different page sizes, fonts, photos, browser encoders, and PDF complexity will produce different byte counts. PNG did not preserve PDF vectors or text; it only preserved the pixels produced by this render.
Export for the content you have
Use JPG for compact photographic pages or PNG for lossless raster text and graphics, then inspect the downloaded images at 100%.
Open PDF page export