title: Why saving as pdf with PIL creates a grey zone around fonts
body: <p>I want to convert a pdf file to png to manipulate within Python, and the save it back as a pdf, but in the process a grey zone gets created around the fonts (my image is a simple black and white typed document). It's very faint, a bit hard to see on a screen, but when printed it becomes fairly visible.</p>
  
  <p>Here's the specific command I use:
  PDF to PNG (in greyscale, super-sampling to preserve image quality):</p>
  
  <pre><code>convert -density 500 -alpha off file_in.pdf -scale 1700x2200 -bordercolor black -border 1x1 -fuzz 20% -trim +repage -colorspace Gray -depth 4 file_out.png
  </code></pre>
  
  <p>within Python</p>
  
  <pre><code>import Image 
  img = Image.open('file_out.png')
  img.save('file_out2.pdf')
  </code></pre>
  
  <p>I also tried converting pdf to png with Ghostscript:</p>
  
  <pre><code>gs -sDEVICE=png16m -sOutputFile=file.png -dNOPAUSE -dBATCH -r300 file_out.pdf 
  </code></pre>
  
  <p>with the save result.</p>
  
  <p>Here's part of what </p>
  
  <pre><code>identify -verbose file.png
  </code></pre>
  
  <p>gives for the ImageMagick png :</p>
  
  <pre><code> Format: PNG (Portable Network Graphics)
    Class: PseudoClass
    Geometry: 1700x2200+0+0
    Resolution: 500x500
    Print size: 3.4x4.4
    Units: Undefined
    Type: Grayscale
    Base type: Grayscale
    Endianess: Undefined
    Colorspace: Gray
    Depth: 8/4-bit
    Channel depth:
      gray: 4-bit
  </code></pre>
  
  <p>Anyone have a solution? or at least an explanation?</p>
  
  <p><strong>Edit:</strong>
  I found that using '-sample 1700x2200' instead of '-scale 1700x2200' fixed the grey around the fonts, but then the thin lines almost disappear and the font suffers from aliasing...</p>