node-pdf-image icon indicating copy to clipboard operation
node-pdf-image copied to clipboard

how to edit image's property? such as: quality, width, height

Open yellowChao opened this issue 8 years ago • 7 comments

yellowChao avatar Jun 16 '16 10:06 yellowChao

https://github.com/mooz/node-pdf-image/pull/21/commits/50ee40945cc25a7e47482d3030d5b65c1e52ac93

alexcroox avatar Jun 23 '16 09:06 alexcroox

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.

alexcroox avatar Jun 23 '16 09:06 alexcroox

We should be using the -size tag to specify an input size but it's ignoring it.

haydenbleasel avatar Aug 24 '16 03:08 haydenbleasel

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

codecounselor avatar Oct 14 '16 01:10 codecounselor

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..

zjr avatar Oct 27 '17 01:10 zjr

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?

tchantzakos avatar Mar 18 '19 12:03 tchantzakos

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

blqke avatar Sep 18 '19 14:09 blqke