unidoc / unipdf-examples

Examples for creating and processing PDF files with UniPDF https://github.com/unidoc/unipdf
https://unidoc.io
272 stars 101 forks source link

Improve compression of ICC color images #69

Closed peterwilliams97 closed 4 years ago

peterwilliams97 commented 4 years ago

Added -c command line switch that converts 1 and 3 component ICC images to DeviceGray and DeviceRGB respectively. green_jobs.pdf

Some sample results

go run pdf_optimize.go  green_jobs.pdf green_jobs.uni.pdf
Compression ratio: 0.29% = 99.71% of original
Processing time: 0.113 sec
go run pdf_optimize.go -c  green_jobs.pdf green_jobs.uni.pdf
Compression ratio: 85.41% = 14.59% of original
Processing time: 3.406 sec
go run pdf_optimize.go  good_guts.pdf good_guts.uni.pdf
Compression ratio: 0.38% = 99.62% of original
Processing time: 1.096 sec
go run pdf_optimize.go -c  good_guts.pdf good_guts.uni.pdf
Compression ratio: 94.58% = 5.42% of original
Processing time: 13.357 sec
gunnsth commented 4 years ago

@peterwilliams97 Would it make sense to provide this particular optimization as an optional/configurable Optimizer in https://github.com/unidoc/unipdf/tree/master/model/optimize ?

This is probably not desirable in cases where people want to archive documents. Probably mostly for on-screen viewing.