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

Support JBIG2Decode filter #40

Closed
gunnsth opened this issue Jan 5, 2019 · 2 comments
Closed

Support JBIG2Decode filter #40

gunnsth opened this issue Jan 5, 2019 · 2 comments

Comments

@gunnsth
Copy link
Contributor

gunnsth commented Jan 5, 2019

Add support for decoding and encoding with the JBIG2 standard.

See section 7.4.7 JBIG2Decode Filter in the PDF reference (PDF32000_2008):

The JBIG2Decode filter decodes monochrome (1 bit per pixel) image data
that has been encoded using JBIG2 encoding.
  • JBIG stands for the Joint Bi-Level Image Experts Group, a group within the ISO that developed the format. JBIG2 is the second version of a standard originally released as JBIG1.
  • JBIG2 encoding which provides for both lossy and lossless compression, is only useful monochrome images, not for color images, grayscale images or general data.
  • The algorithms are described in ISO/IEC 11544 published standard for the current JBIG2 specification.
  • In general JBIG2 provides considerably better compression than the existing CCITT standard.

The optional parameters for JBIG2Decode filter in PDF are:

  • JBIG2Globals - a stream containing the JBIG2 global (page 0) segments.

See also Example 1 in the standard which can be used as a testcase.

Implementation

  • Makes sense to implement as a package jbig2 that can be included internally in unidoc. Should be licensed with the same license as the unidoc project.
  • Start by focusing on decoding, can use the example provided in the PDF reference, and extract some JBIG2Decoded data from PDF files
  • Code should follow the unidoc style guide
  • Encoding should also be implemented in the package

Notes

I am currently not aware of any golang implementations of JBIG2. However, there are a few open source implementions in other languages that might be a good reference.

@gunnsth gunnsth transferred this issue from unidoc/unidoc May 24, 2019
@gunnsth
Copy link
Contributor Author

gunnsth commented Jul 18, 2019

Decoder implemented by #67 #121 and first released in unipdf v3.0.1.

@gunnsth
Copy link
Contributor Author

gunnsth commented May 3, 2020

Support has been added for generic encoding, see https://unidoc.io/news/jbig2-support-in-golang

@gunnsth gunnsth closed this as completed May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant