Quote:
Originally Posted by willus
Thank you for this detailed answer. After reading about how the contrast-stretch option works in ImageMagick, I've learned something new. I may change the way k2pdfopt does contrast adjustment now. I'll have to try a few test cases.
|
I will have to research this topic/methods a lot more as well.
That method was just something I came up with in a few hours as a ROUGH resizing (better than nothing, but definitely not something I would use in an ebook for sale). There has to be much better Imagemagick solutions that exist out there.
Most of the time when I run across Doitsu's problem in all the books I work on is microscopic images of Greek text... but instead of me doubling/tripling the size, I just turn it into the actual Unicode characters instead. :P
* * * * *
I remember when I was trying to come up with a despeckling solution to clean up PDF scans. I spent days reading everything on Google, I somehow stumbled upon a REALLY obscure Imagemagick post that had the (close-to-perfect) solution.
If you did a search for it in Google, it was one of those where you get "6 hits" and/or it was buried on "page 1000" of a normal search (like "Imagemagick despeckling" or "cleaning speckles in PDF scans").
If I remember correctly, they did it by shrinking, then expanding pixels, then creative a diff image. Then step through and remove any group of non-fully-black pixels that was smaller than X x Y. This would get rid of little 1x1, 1x2, 2x1, 2x2, 3x2, [...] specs of dust all over the page.
Then it would reverse the expansion and use the diff image to try to return it to its original form.
It did a pretty fantastic job compared to ANYTHING I ever found before/since... BUT the downfall was sometimes the fine details would disappear... like the very tip of a comma, or the tip of a serif font, or little umlaut above a character in a footnote, or a badly scanned period would just poof.
Or complicated edges/lines would go poof (like a dashed line in a graph, or a very thin line separating the bottom of the text from the footnote section).
Definitely helped me in many cases though, and helped cut down on the size of some speckled PDFs/Images DRAMATICALLY.
And you had to weigh what would be worse... a whole PDF full of little speckles? Or the tiny end of a comma or an accent disappearing. :P
* * * * *
Then you get the REALLY obscure/ingenious stuff... like using ImageMagick to add line numbers to a PDF:
https://tex.stackexchange.com/questi...mbers-to-a-pdf
I mean look at that top answer... genius.
Coming up with super genius ways to compare the average color of a line, to tell if it was actual text or "blank space".