aheckmann / gm

GraphicsMagick for node
http://aheckmann.github.com/gm/
6.95k stars 615 forks source link

Output image resolution of pdf file not matching the source #837

Closed IgorRomanvsky closed 3 years ago

IgorRomanvsky commented 3 years ago

I'm trying to convert pdf into image and i just can't understand how should i adjust the output resolution. If i'm doing like this:

 gm(`${sourcePath}[0]`)
      .setFormat('jpg')
      .stream()
      .pipe(writeStream); 

The output quality here is very low, so i'm trying to use density(594, 842) like that:

gm(`${sourcePath}[0]`)
      .setFormat('jpg')
      .quality(100)
      .density(595, 842)
      .stream()
      .pipe(writeStream);

but doing this the image looks very starchy.

Can anyone please point me what should i do in order to receive the output image close as possible to the pdf source?

Thanks!