Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise graphics (PNG+PDF) with zopflipng and ghostscript #5529

Closed
wants to merge 2 commits into from
Closed

Optimise graphics (PNG+PDF) with zopflipng and ghostscript #5529

wants to merge 2 commits into from

Conversation

Rigo-V
Copy link

@Rigo-V Rigo-V commented Feb 24, 2019

Shaved 1.8MiB off the pdf files test/*.pdf.

@Rigo-V
Copy link
Author

Rigo-V commented Feb 24, 2019

This seems to contain the PNG optimisations from the pull request 5527 as well, so I closed that one.

@Rigo-V Rigo-V changed the title Optimise test PDFs Optimise graphics (PNG+PDF) with zopflipng and ghostscript Feb 24, 2019
@michaelrsweet
Copy link
Collaborator

Since these files are generated using a separate program, and since Ghostscript-generated PDFs are not always the nicest, I hesitate to accept this pull request. Will investigate incorporating zopflipng (or something like it) into the PNG generation toolchain, but Ghostscript is a non-starter for this.

@michaelrsweet michaelrsweet added this to the Future milestone Feb 25, 2019
@michaelrsweet michaelrsweet self-assigned this Feb 25, 2019
@Rigo-V
Copy link
Author

Rigo-V commented Feb 25, 2019

I understand your hesitation regarding the use of ghostscript. It sometimes make ugly pdfs. I used this command:
gs -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -sOutputFile=file.pdf file.pdf.uncompressed
for compressing onepage-a4.pdf, onepage-letter.pdf, document-a4.pdf and document-letter.pdf, and cannot notice any loss of detail in the compressed files.
I cannot remember which exact command I used for the testfile.pdf, but there seems to be no degradation in it either (apart from the non-functioning hyperlinks, but that shouldn't be much of a problem since the file is for testing printing, right?

It'd obviously be fantastic if you incorporated optimisations in your toolchain itself. If that happens I definitely wouldn't mind this PR be rejected. Zopflipng seems like the best but also the slowest. But since the PNGs seem to be changed very rarely, this shouldn't be much of an issue.
I use the following options myself:
--iterations=500 --filters=01234mepb --lossy_transparent

michaelrsweet added a commit that referenced this pull request May 15, 2019
@michaelrsweet michaelrsweet added the enhancement New feature or request label May 15, 2019
@michaelrsweet michaelrsweet modified the milestones: Future, CUPS 2.3.x May 15, 2019
@michaelrsweet
Copy link
Collaborator

OK, I've done a bunch of testing and am happy with the results. Changes are getting pushed now...

@michaelrsweet
Copy link
Collaborator

OK, changes are now merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants