Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on lemmy.world
datahoarder·Data Hoarderbya_fancy_kiwi

Converting physical books to digital?

I’m about to start looking into converting the physical books I own into ePubs so I can put them in my Kavita library and have the option to reread them on my eReader.

Has anyone built an app to do OCR and auto-convert to ePub? Or if anyone has a workflow that they like or even just tolerate, I’d like to hear about it.

Also, this probably doesn’t fit in this sub but is there a store that would allow me to buy physical books that also come with an ePub download link?

Thanks

View original on lemmy.world
11

3 replies

reddthat.com

I've done this successfully twice with local LLMs. One of the cases was a book of data that I needed to be able to be able to pull examples from quickly, and the other was a long printed prose document that I didn't have a digital copy of but wanted to be able to reference on my kindle. The book of data was much trickier to transcribe overall (multi-column layout + text that was more prone to hallucination/typo output + entries split across pages in a way that was awkward to accumulate), but both had some challenges.

The general workflow was:

  • actually scan the documents
  • pass each scanned image through the LLM with several prompts, logging the results
  • do a merge pass (per page) on the LLM's results including he final formatting I needed
  • concatenate/merge the per-page results into a single document
  • final processing (e.g. Markdown -> HTML -> ebook with calibre for the prose document)

I did a combination of automated and manual verification + some manual cleanup. In both cases the results likely are not perfect transcriptions, but were good enough for my needs.

I wrote a few scripts to run scanimage on Linux with the appropriate parameters to save into automatically numbered sequential images as I turned pages -- separating evens and odds for one of them since the book did not fit nicely on my scanner. That simplified the process of scanning a lot, but it was still quite tedious. I automatically displayed the image after each scan and had a flag to rescan the last page -- which I needed to do occasionally.

It took some experimentation to get the prompts right and I don't have a complete, easy-to-use process to share; what I've got right now needs tweaking per book/document.

Some of the prompts were things like this though:

Transcribe the text on page {{page_number}}. Do not include headers (e.g. author, book title, page number, etc).

and

Which words (if any) are italicized on page {{page_number}}? Output the word/snippet -- plus context. This may include individual words, phrases, or entire sentences. Look carefully.

Having it convert to Markdown was helpful to get styling although it wasn't always consistent about it. I had better results using simple prompts and multiple passes than trying to get it to do things all at once in a single detailed prompt.

I set a thinking budget (1000~2000 tokens depending on task) and used a low temperature. I got about ~100 pages an hour on the simpler prose document (per pass) with Qwen 3.6 at Q6_K quant on an R9700 GPU. I suspect you could probably do similar with Gemma4 on a lower VRAM GPU if needed.

2
lemmy.world

OCR software is out there and usually accessible for free. Like Android, Mac OS, and Windows all have them incorporated somewhere.

5

If you've got a better suggestion, please feel free to post it. This is what I've actually done for scanning books that was tolerable but I definitely do not know everything that's out there.

The other main free OCR software I know of is Tesseract and it needs much better scans and more preparation to get good quality out of. It does not handle italics in the current version and struggled with the tables I needed to work with when I tried it. It is faster when it works, but also frequently makes mistakes that need cleanup like outputting ¥ instead of Y (or vice-versa). I've made heavy use of it in automated pipelines before, but a local LLM + a little scripting is way easier to get decent results out of.

1

You reached the end