So when I produce a JPEG from a PDF with Wand and Python, I can see how some lines of the staff are different size, but when I zoom with MS Edge, they’re same size… and I can not find the way of doing it same way.
Wand
First answer method:
convert +antialias -density 1200 Betlem.pdf -alpha off -resize 640x -monochrome A_betlem_m_en_vull_anar.png
I’ve tried poppler, pdftocairo, pdf2(png¦svg), inkscape, etc…
pdf = wi(filename = "Betlem.pdf", resolution = 300) pdfImage = pdf.convert("jpeg") d = 1 for img in pdfImage.sequence: page = wi(image=img) page.save(filename="Betlem_" + str(d) + ".jpg") d += 1
I expect a result where I can see the staff and notes same way of scaling than in Edge (best) or Firefox (great).
As follows the PDF: http://www.xn--estudiantladolaina-lvb.com/partitures/baixa/pdf/26
EDITED:
You can see how it is rendering bad because of errors in the SVG information on the PDF:
Answer
Using Imagemagick 6.9.10.55 Q16 Mac OSX and Ghostscript 9.25, I can convert at high quality using supersampling (4x nominal 72 dpi density and resize down by 1/4 to normal scale) as
convert -density 288 A_betlem_m_en_vull_anar.pdf -alpha off -resize 25% A_betlem_m_en_vull_anar.png
How does this compare to your MS Edge view? (Download my image and view it).
ADDITION:
Here is the same code in Python Wand, which uses Imagemagick.
!/bin/python3.7
from wand.image import Image with Image(filename='A_betlem_m_en_vull_anar.pdf', resolution=288) as img: img.alpha_channel='off' img.resize(width=int(0.25*img.width),height=int(0.25*img.height)) img.save(filename='A_betlem_m_en_vull_anar.png')