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

Add a flag to control quality #13

Open
micahflee opened this issue May 27, 2015 · 4 comments
Open

Add a flag to control quality #13

micahflee opened this issue May 27, 2015 · 4 comments

Comments

@micahflee
Copy link
Contributor

Right now when pdf-redact-tools explodes a PDF into PNGs, the PNGs are all medium quality in order to make sure the final redacted PDF doesn't end up too big. However sometimes the quality is too low. It would be good to expose a quality option to users as a command-line flag.

@masetime
Copy link

Bingo. I just used pdf-redact-tools for the first time and the quality of the output I got was unusable for my needs.

There really needs to be an option to control the quality level.

@anaisabel7
Copy link

anaisabel7 commented Jun 8, 2017

So, I added a flag to specify quality in the PR above, however, I don't know much about image quality or compression.
I checked the information is sent to the convert command, but I cannot tell whether it makes the expected difference in the PNG files.
Also, please, let me know if I need to set limits to the values of quality (besides them being integers).

Maybe @micahflee @masetime have some idea about this since you were commenting on the quality of the PNGs

@chaserx
Copy link

chaserx commented Jul 2, 2017

I've currently hit the same thing where the loss of image quality is unacceptable.

Since the -quality flag is about compression, maybe we should use the -density flag to increase the density to -density 300. ImageMagick's default is 72. Here, on line 55, it's being set to 128.

A similar plan to what @anaisabel7 has done in #24 could be applied for density.

@chaserx
Copy link

chaserx commented Jul 2, 2017

I've found that that using ghostscript directly, you retain pretty good PNG resolution from a PDF.

gs -sDEVICE=png16m -dTextAlphaBits=4 -r300 -o foo.png bar.pdf

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