View Single Post
Old 03-19-2021, 01:08 AM   #83
stevenaleach
Enthusiast
stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.stevenaleach can bend spoons with a thought.
 
Posts: 46
Karma: 134116
Join Date: Oct 2013
Device: Android Tablet
Just 'finished' a tool that others mixing micro-controllers and ePaper might find useful:
https://github.com/stevenaleach/PDFto4BC It.s a Python tool to convert .PDF files into a form more friendly to low power low memory devices. Pages are run-length encoded pixel-pairs (two pixels per byte) and the compression seems to average at about 14% of what the raw (1 byte per pixel) pixmaps would take up. I'm converting to 1404x1872 because that's the size of the Waveshare display I'm waiting on. The first full book I converted was Stephen Levy's 'Hackers' - 520 pages that would occupy 1.366 GB as uncompressed pixmaps or 683.3MB as packed pixels, two per byte -- the run-length compression brings this down to ~170MB with no cropping applied - 215MB with nice cropping to nearly eliminate margins. Not too bad - at that ratio I can store nearly 2,500 pages per GB - and some texts compress better - I've been testing on several .PDFs of Creative Commons licensed books, and when I ran the file I have for Charles Stross's book 'Accelerando' (819 pages), it came out at 186MB -- or 4,500 pages per GB.... fonts matter... text with thicker and softer fonts will compress less than those with thin and sharp edged fonts... and of course images don't compress well (the cover of Hackers, for instance squeezes down to about 34% of the 'raw'' size while the pages are about 14%).

https://github.com/stevenaleach/PDFto4BC
stevenaleach is offline   Reply With Quote