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

Making jbig2enc treat black as white and vice verse #80

Open
yobesispa opened this issue Jan 22, 2023 · 0 comments
Open

Making jbig2enc treat black as white and vice verse #80

yobesispa opened this issue Jan 22, 2023 · 0 comments

Comments

@yobesispa
Copy link

yobesispa commented Jan 22, 2023

Hello.

I am trying to compress a batch of about 450 purely black-and-white images, all of which are pages of a book. The colour depth of all images is 1 -- each pixel is either completely black, or it is completely white. (bpp=1)

The peculiarity of my use-case is that the images are white text on a black background rather than the "normal" black-text-on-white-background. This is because they have to be used as "image masks" in a much larger file on which I don't have much control.

I have compressed this 25MB white-text-on-black-background image group using jbig2 -t 0.9 -s -p -S <all-images> , resulting in 11MB compressed image data.

Out of curiosity, I then "inverted" the colours in all images so that they become ordinary black-text-on-white-background images, and compressed the resulting image group using the same command. This time, the whole compressed image data amounted to only 2MB!

To me, this means that if my use case allowed me to invert my white-text-on-black-background images before compressing them with jbig2enc, I could have obtained a much better compression ratio: 2MB compared to 11MB, in my particular case.

Now that I am not allowed to invert my image, is there any way for me to tell jbig2enc treat black as white and vice versa?

Many thanks!

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