Skip to content

RamKromberg/pdfScale.sh_is_lossy

Repository files navigation

A small test example showing ghostscript recompresses some pngs into jpegs rendering pdfScale.sh's output lossy.

The issue is disscussed here here.

Dependencies:

  • img2pdf
  • python + pymupdf
  • pdfScale.sh (ghostscript)
  • imagemagick
  • pdfimages

Starting with in.png:

in.png

We santifize with imagemagick into sample.png:

sample.png

We convert to pdf with img2pdf, dump using pdfimages and compare with magick:

sample1.pdf

sample1-000.png

sample1-000-diff.png

Result: img2pdf is lossless.

Same with pdfScale.sh:

sample2.pdf

sample2-000.jpg

sample2-000-diff.png

Result: GhostScript (via pdfScale.sh) recompresses to jpeg and introduces artifacts.

Now just GhostScript:

sample3.pdf

sample3-000.jpg

sample3-000-diff.png

Result: GhostScript (alone) introduces artifacts.

Finally, pdfScale.py:

sample4.pdf

sample4-000.png

sample4-000-diff.png

Result: pdfScale.py is lossless.

Conclusion: GhostScript is lossy and pdfScale.sh is affected.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published