nycynik / PythonPDFtoPNG

Converting a PDF to a PNG using wand, pythonMagic and PythonMagicWand as a comparison
GNU General Public License v3.0
16 stars 6 forks source link

Converting PDFs to PNGs #2

Open jjhelfman opened 4 years ago

jjhelfman commented 4 years ago

The following code outputs extremely faint png files for the pdf files I am using:

from __future__ import print_function
from wand.image import Image

with Image(filename='source.pdf') as img:
    with img.convert('png') as converted:
        converted.save(filename='pyout/page.png')

I tried experimenting with export_pixels() method but still did not get my PNG output as desired. For now, I will be converting to JPEG since the wand module seems to work well for those.

nycynik commented 3 years ago

Thanks for the feedback, I'll note that jpeg is better than PNGs.