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:
We santifize with imagemagick into sample.png:
We convert to pdf with img2pdf, dump using pdfimages and compare with magick:
Result: img2pdf is lossless.
Same with pdfScale.sh:
Result: GhostScript (via pdfScale.sh) recompresses to jpeg and introduces artifacts.
Now just GhostScript:
Result: GhostScript (alone) introduces artifacts.
Finally, pdfScale.py:
Result: pdfScale.py is lossless.
Conclusion: GhostScript is lossy and pdfScale.sh is affected.