-
Notifications
You must be signed in to change notification settings - Fork 14
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
I don't understand this picture #32
Comments
I agree that in the case of little text this might be overkill. The thought was that it would help compress the images, but it might not have to go down all the way to the bottom. What would you suggest the foreground looks like to optimise quality and size? |
The reason this is done, by the way, is that if we would only fill in the foreground parts and leave the rest black, the compression would (severely) affect the colours in the foreground image. Initially I had something a little different, which would "radiate" the foreground colours in all directions, mixing them in according to other colours in the vicinity (like here https://archive.org/~merlijn/projects/archive-pdf-tools/doc-imgs/alien-mrc-fg.png), but this was quite slow (like, 10-20x slower), and ultimately didn't compress much better, nor give much better quality. |
The DjVu-philosophy is to use the cheapest coding behind occlusions. c44 compression is optimized for that. So I think the best picture would depend on the chosen compression. If there exists a PDF-compatible picture compressor that takes into account the occlusion mask that might be helpful.
Outlook voor Android downloaden<https://aka.ms/ghei36>
…________________________________
From: Merlijn Wajer ***@***.***>
Sent: Tuesday, November 30, 2021 9:34:06 PM
To: internetarchive/archive-pdf-tools ***@***.***>
Cc: rmast ***@***.***>; Author ***@***.***>
Subject: Re: [internetarchive/archive-pdf-tools] I don't understand this picture (Issue #32)
The reason this is done, by the way, is that if we would only fill in the foreground parts and leave the rest black, the compression would (severely) affect the colours in the foreground image. Initially I had something a little different, which would "radiate" the foreground colours in all directions, mixing them in according to other colours in the vicinity (like here https://archive.org/~merlijn/projects/archive-pdf-tools/doc-imgs/alien-mrc-fg.png), but this was quite slow (like, 10-20x slower), and ultimately didn't compress much better, nor give much better quality.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#32 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAZPZ5VL6LM3BA43IK3IDVDUOUYL5ANCNFSM5JCRL56Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Right, so the constraints are that it must be encoded in an image format the PDF supports, so no images with custom compression can be embedded. If you can figure out a way to use c44 compression on a mask + input image and create (say) a PNG or TIF file from that, I could look at turning that into a JPEG/JPEG2000 and see if it compresses better or at least provides better quality. Some JPEG2000 encoders support "region of interest" (ROI) encoding, where they actually take a mask with the region that should be better encoded than other parts, but I tried for days to get that to produce anything sensible, and it never worked well for me. |
Then you're probably also further than this publication:
https://www.researchgate.net/publication/3180593_JPEG2000_coded_images_optimization_using_a_content-dependent_approach
Outlook voor Android downloaden<https://aka.ms/ghei36>
…________________________________
From: Merlijn Wajer ***@***.***>
Sent: Tuesday, November 30, 2021 9:58:49 PM
To: internetarchive/archive-pdf-tools ***@***.***>
Cc: rmast ***@***.***>; Author ***@***.***>
Subject: Re: [internetarchive/archive-pdf-tools] I don't understand this picture (Issue #32)
Right, so the constraints are that it must be encoded in an image format the PDF supports, so no images with custom compression can be embedded. If you can figure out a way to use c44 compression on a mask + input image and create (say) a PNG or TIF file from that, I could look at turning that into a JPEG/JPEG2000 and see if it compresses better or at least provides better quality.
Some JPEG2000 encoders support "region of interest" (ROI) encoding, where they actually take a mask with the region that should be better encoded than other parts, but I tried for days to get that to produce anything sensible, and it never worked well for me.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#32 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAZPZ5U4FRCYO3C5IOXX7HDUOU3ITANCNFSM5JCRL56Q>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I was looking at the ROI in the documentation https://gist.github.com/ahankinson/494572, and close by in the same part of the manual was another construction: "VIS means visual masking;" |
I do not have clear whether this 'masking' allows providing a mask, or is some result of locally interpreting of the provided image. |
One of the writers has 60 patents on his name, however the publication is almost 20 years old. |
"Because the layer coder employed is wavelet-based Sounds a bit like what I tried to do initially, and then made a fast approximation for later on (the image in your first post in this issue). Maybe it makes sense to make the background in the foreground image gray, and not black, for more smoothness. |
Why would we need so many colors smeared to the bottom right that are not behind the foreground mask?
Those could all be optimized away to facilitate Run Length Encoding.
The text was updated successfully, but these errors were encountered: