Page 2 of 2

Re: eclec-tech

Posted: Mon Oct 31, 2016 8:26 pm
by dw
Sent from my Samsung Galaxy S6...
it appears this forum isn't so Smartphone unfriendly after all. :lurk:

Re: eclec-tech

Posted: Thu Jun 24, 2021 7:08 am
by carsten
Maybe somebody might find this useful:

If you find old shoe making books on the internet, often they have a yellow background and are hard to read when printed in black and white.

see e.g.: https://openlibrary.org/search?mode=eve ... ure&page=1

where you for example can find a book from golding, which might be too yellow to print on paper: https://archive.org/details/manufactureofboo00goldrich

Should you have a linux machine available you can easily fix this by using imagemagick and a textcleaner script provided by Fred Weinhaus.

see http://www.fmwconcepts.com/imagemagick/ ... /index.php

To convert full pdf books I added some stuff around it, which first extracts each page to a JPG image, cleans it and re-assembles everything back to a pdf. (Splitting and assembling is somewhat easier using Adobe Acrobat DC - but not everybody has it)

Here is the script (takes quite long to run though) and result for linux bash command line. To use it, download the textcleaner from Fred (link above) Throw the following code in a shell file e.g. "conv.sh", make it executable and run it as ./conv.sh filenameyouwanttoclean (without ".pdf")

Of course it does also work on non shoe making books :rofl:

------------------------------------------------------------------------------------
strings < $1.pdf | sed -n 's|.*/Count -\{0,1\}\([0-9]\{1,\}\).*|\1|p'| sort -rn | head -n 1 > pages.txt
pages=$(cat pages.txt)

echo $pages

for ((i=1; i<=$pages; i++))
do
echo $i 'of ' $pages 'done '
convert -density 300 -trim $1.pdf[$i] -quality 100 $1-$i.jpg
./textcleaner -g -e stretch -f 15 -o 5 -s 1 $1-$i.jpg final-$i.jpg
done
convert -monitor `ls -1v final*` file.pdf
----------------------------------------------------------------------------


Here is one treated page as a sample: (Before and after)
manufactureofboo00goldrich_Page_024.jpg
final-024.jpg