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

Compress: Expand colorspace handling for images and make processing more generic #54

Closed
gunnsth opened this issue Apr 19, 2019 · 1 comment
Labels
compress Compression / Optimization enhancement New feature or request

Comments

@gunnsth
Copy link
Contributor

gunnsth commented Apr 19, 2019

Currently the colorspace handling only supports DeviceGray and DeviceRGB and the handling is simplistic only looping through the images in XObject and compressing all of those. If any image was never used in the contentstream it would still not be removed for example.
Also this means that inline images are not handled.

The handling should be made more generic and use the ContentStreamProcessor to process the contents. The colorspace handling should also be more generic and fall back to alternative colorspaces in cases where not properly supported. The handling should be similar as for example in:
https://github.com/unidoc/unidoc-examples/blob/v3/pdf/advanced/pdf_grayscale_transform.go

although we can ignore handling of patterns and shadings at the moment.

Take care to remove resources that are not used. Perhaps that should be its own optimization as it makes sense to remove images, fonts, colorspaces or any other resources that are not actually used.

@gunnsth gunnsth transferred this issue from unidoc/unidoc May 24, 2019
@gunnsth gunnsth added compress Compression / Optimization enhancement New feature or request labels Jun 2, 2020
@anovik
Copy link

anovik commented Dec 2, 2024

Currently:

  • inline images are handled
  • optimize package handles removing images and other resources that are not used in PDF
  • shadings are partly handled
  • fall back to alternative colorspace is done

@anovik anovik closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compress Compression / Optimization enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants