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: Detect binary images and encode with a binary image encoding algorithm #53

Open
gunnsth opened this issue Apr 19, 2019 · 0 comments
Labels
compress Compression / Optimization enhancement New feature or request

Comments

@gunnsth
Copy link
Contributor

gunnsth commented Apr 19, 2019

Images with only 2 values (min/max) are suitable for encoding with CCITTFaxDecode and JBIG2 (when encoding support is ready).

Add a flag BinaryImageOptimization = true by default which looks at the image values and detects whether it is suitable for encoding with CCITTFaxDecode. Note that this is slightly different from #428 as this involves looking at the values (color histogram), for example a BitPerComponent = 8 using only color values 0/255 would be suitable for encoding as a binary image.

It might also make sense to define some threshold so that the number of pixels outside the min/max bins could be defined so that a certain percentage of pixels could fall outside and would be interpolated to the closest bin. For example if 99% of pixels fall into 0, 255 and then there are some pixels with values 1,5,9,230, 150, 250, those would be interpolated to the closest value 0,0,0,255,255,255 so that there are only 2 values prior to feeding to the CCITTFaxDecode algorithm. The threshold should be defined as BinaryImageOptimizationThreshold = 0.99 (float64).

@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
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

1 participant