Question

How can I programmatically and reliably create PNG images from CHM and EPUB files? The page that's needed is only the first one, as in "cover image thumbnail generation".

Could this even be done just from the command line?

I have already looked at the open-source CHM QuickLook plug-in for MacOSX for source that does this and at Calibre, the latter to no avail.

Was it helpful?

Solution

In CHM, the default page is a webpage (a .html file). Of course it can only contain one page.

An extracter program is easy to do based on chmlib or Free Pascal's libs, but it will need the html parsed to also find names of other programs to extract. Roughly the algorithm would be:

  • use some "list" function of a cmdline extract tool to get the default page's name. (this is stored in an internal record)
  • extract it, and parse it for img and other referencing tags.
  • extract those.
  • The biggest picture downloaded in the previous step is probably "it"!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top