node-pdf-image
node-pdf-image copied to clipboard
how to edit image's property? such as: quality, width, height
https://github.com/mooz/node-pdf-image/pull/21/commits/50ee40945cc25a7e47482d3030d5b65c1e52ac93
The quality flag doesn't seem to do much for me, the image contained in my test PDF is of very high quality but it comes out heavily pixilated even at medium sizes using the linked options.
We should be using the -size tag to specify an input size but it's ignoring it.
Many ImageMagick options must come after the filename, see this example http://stackoverflow.com/a/6605085
But the code currently lists them all before the source file.
(These are known as Image Operators )
Update: It seems that this is actually working despite the ordering
The PDFImage
'class' takes a second options parameter. You can use it like this:
const pdfImageOpts = {
outputDirectory: path.join(__dirname, './wmReports/images'),
convertExtension: 'jpg',
convertOptions: {
'-colorspace': 'RGB',
'-interlace': 'none',
'-density': '300',
'-quality': '100'
}
};
const pdfImage = new PDFImage(file, pdfImageOpts);
pdfImage.convertPage… // etc. etc..
The quality flag doesn't seem to do much for me, the image contained in my test PDF is of very high quality but it comes out heavily pixilated even at medium sizes using the linked options.
almost 3 years later but did you find any solution to avoid the pixilized output image?
The quality flag doesn't seem to do much for me, the image contained in my test PDF is of very high quality but it comes out heavily pixilated even at medium sizes using the linked options.
almost 3 years later but did you find any solution to avoid the pixilized output image?
Had the same problem, the -density
parameter resolved my case