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 for CCITT group 4 compression in UTIF.encodeImage #132

Open
sujithj-git opened this issue Jan 28, 2025 · 1 comment
Open

Support for CCITT group 4 compression in UTIF.encodeImage #132

sujithj-git opened this issue Jan 28, 2025 · 1 comment

Comments

@sujithj-git
Copy link

The UTIF.encodeImage method currently encodes TIFFs without any compression, leading to significantly larger output file sizes.

The library's documentation mentions support for Fax 4 (CCITT Group 4) compression. My goal is to encode a TIFF with CCITT Group 4 compression from image data (e.g., a PNG).

Could someone provide an example or guidance on how to correctly use UTIF.encodeImage to apply CCITT Group 4 compression? Specifically, how should the metadata and data be structured for this to work?

@photopea
Copy link
Owner

Currently, UTIF.js uses DEFLATE (GZIP) compression for encoding, if the "pako" library is available, see

var cmpr = (window && window.pako) ? 8 : 1;

I have a TIFF file of 18 kB with CCITT compression (1728 x 2376 pixels), when encoding it with UTIF.js (DEFLATE with PAKO), it becomes 66 kB. If there was no compression, it would be 1 bit per pixel (513 kB).

Are you aware that CCITT supports only black-and-white pixels? There are no colors and no shades of gray.

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

2 participants