node-pdf-image
node-pdf-image copied to clipboard
How to convert PDF document to PNG image without compression?
Setting quality option doesn't work for me. What should i put to convertOptions: { "-quality": "???" "-???" : "???" }?
it work technically with value "100".
convertOptions: {
"-quality": "100"
}
The quality setting has no effect on the appearance or signature of PNG and MNG images, since the compression is always lossless.
Not all combinations of compression level, strategy, and PNG filter type can be obtained using the -quality option. For more precise control, you can use the PNG:compression-level=N, PNG:compression-strategy=N, and PNG:compression-filter=N defines, respectively, instead. See -define. Values from the defines take precedence over values from the -quality option.
for more information please read command-line-options.php#quality
After I execute "brew install graphicsmagick" it worked for me const BLUR_RATIO = 4; let pdfImage = new PDFImage(pdfName, { graphicsMagick: true, convertOptions: { '-density': ''+72*BLUR_RATIO, '-resize': Math.round(100/BLUR_RATIO)+'%' } });
Try higher density, for eg. :
convertOptions: { "-density": "300", "-quality": "100" }
@TylerCreator Looking at your code, I wondered if your density value was even valid given that code (which does work) and I wanted to throw this out there as a more readable and safer approach: (72 * BLUR_RATIO).toString()
Did you get things working as you wanted? I'm working along the same path right now, though no issue yet. I'm just doing my research first.