<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kuickkonvert</title>
    <description>The latest articles on DEV Community by kuickkonvert (@kuickkonvert).</description>
    <link>https://dev.to/kuickkonvert</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4244285%2F4db5d59e-0c39-4f9d-a1eb-e431e6198218.png</url>
      <title>DEV Community: kuickkonvert</title>
      <link>https://dev.to/kuickkonvert</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kuickkonvert"/>
    <language>en</language>
    <item>
      <title>I ran three PDFs through Ghostscript's /screen, /ebook and /printer presets. Here's what happened to each.</title>
      <dc:creator>kuickkonvert</dc:creator>
      <pubDate>Sat, 14 Nov 2026 10:24:30 +0000</pubDate>
      <link>https://dev.to/kuickkonvert/i-ran-three-pdfs-through-ghostscripts-screen-ebook-and-printer-presets-heres-what-happened-4hig</link>
      <guid>https://dev.to/kuickkonvert/i-ran-three-pdfs-through-ghostscripts-screen-ebook-and-printer-presets-heres-what-happened-4hig</guid>
      <description>&lt;p&gt;If you've wired Ghostscript into a "compress PDF" feature, you've probably reached for &lt;code&gt;-dPDFSETTINGS&lt;/code&gt;. I maintain a small open-source file converter (Flask, Ghostscript and LibreOffice; disclosure: it's my project, KuickKonvert). I wanted to know what the three common presets actually do to ordinary files, so I tested them and published the inputs, outputs and script.&lt;/p&gt;

&lt;h3&gt;
  
  
  The command
&lt;/h3&gt;

&lt;p&gt;Ghostscript 10.02.1, the same options the converter uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen \
   -dAutoRotatePages=/None -dNOPAUSE -dQUIET -dBATCH \
   -sOutputFile=out.pdf in.pdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/ebook&lt;/code&gt; and &lt;code&gt;/printer&lt;/code&gt; were swapped in for &lt;code&gt;/screen&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The three inputs
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Original&lt;/th&gt;
&lt;th&gt;/screen&lt;/th&gt;
&lt;th&gt;/ebook&lt;/th&gt;
&lt;th&gt;/printer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;One 3000 × 2000 px photo placed at 300 dpi&lt;/td&gt;
&lt;td&gt;1,096.3 KB&lt;/td&gt;
&lt;td&gt;495.3 KB (45.2%)&lt;/td&gt;
&lt;td&gt;58.3 KB (5.3%)&lt;/td&gt;
&lt;td&gt;881.2 KB (80.4%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One-page greyscale scan, A4 at 200 dpi&lt;/td&gt;
&lt;td&gt;915.3 KB&lt;/td&gt;
&lt;td&gt;138.0 KB (15.1%)&lt;/td&gt;
&lt;td&gt;733.7 KB (80.2%)&lt;/td&gt;
&lt;td&gt;736.3 KB (80.4%)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Five-page text-only PDF (standard Helvetica, not embedded)&lt;/td&gt;
&lt;td&gt;5.6 KB&lt;/td&gt;
&lt;td&gt;5.5 KB (99.0%)&lt;/td&gt;
&lt;td&gt;5.5 KB (98.9%)&lt;/td&gt;
&lt;td&gt;11.5 KB (206.5%)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Three things I didn't expect
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. /screen was not the smallest for the photo.&lt;/strong&gt; /screen downsampled the photo to 720 × 480 px (72 dpi) but stored it with lossless Flate compression. /ebook kept 1500 × 1000 px (150 dpi) but used JPEG, and came out at 58 KB against 495 KB. The photo here is synthetic (generated noise with grain), so a real camera photo may behave differently, but it was enough to stop me assuming /screen always wins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The scan barely moved on /ebook and /printer.&lt;/strong&gt; Only /screen made a real difference (15% of the original). At 200 dpi, the scan was already close to what the other two presets aim for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. A text-only PDF can grow.&lt;/strong&gt; /printer doubled the five-page text file. My guess is that it embedded the font, but I haven't confirmed that from the output file, so treat it as a guess.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I do in the app because of this
&lt;/h3&gt;

&lt;p&gt;After Ghostscript runs, the converter checks two things: that the output has the same number of pages as the input (Ghostscript can exit with code 0 and still write a blank one-page PDF for some damaged files), and that it is actually smaller. If it isn't smaller, the user gets their original file back. The size check, simplified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shutil&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;keep_smaller&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getsize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getsize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;shutil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copyfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# compression didn't help: return the original&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Takeaways
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Look at what is inside the PDF before compressing: images are where the weight is.&lt;/li&gt;
&lt;li&gt;Don't assume the "lowest" preset gives the smallest file; test /ebook too.&lt;/li&gt;
&lt;li&gt;Always compare the output with the input, and fall back to the original.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Reproduce it
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Files, results and the script that regenerates everything from fixed seeds&lt;/strong&gt; (CC BY 4.0): &lt;a href="https://doi.org/10.5281/zenodo.24199945" rel="noopener noreferrer"&gt;https://doi.org/10.5281/zenodo.24199945&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Converter source&lt;/strong&gt; (AGPL-3.0): &lt;a href="https://github.com/khshahid1970/kuickkonvert" rel="noopener noreferrer"&gt;https://github.com/khshahid1970/kuickkonvert&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; each test uses a few generated files. Other Ghostscript versions and real-world documents will give different numbers.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>pdf</category>
      <category>ghostscript</category>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
