Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

How to convert PDF document to PNG image without compression? #40

Open
TylerCreator opened this issue Jun 3, 2018 · 4 comments
Open

Comments

@TylerCreator
Copy link

TylerCreator commented Jun 3, 2018

Setting quality option doesn't work for me. What should i put to
convertOptions: {
"-quality": "???"
"-???" : "???"
}?

@roest01
Copy link
Contributor

roest01 commented Jun 3, 2018

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

@TylerCreator
Copy link
Author

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)+'%'
}
});

@dkonsoftware
Copy link

dkonsoftware commented Jan 4, 2019

Try higher density, for eg. :
convertOptions: { "-density": "300", "-quality": "100" }

@rainabba
Copy link

rainabba commented Feb 7, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants