Is there a way to convert the epub format to images?

I need a tool to convert epub files to a series of images programmatically. The result should look like screenshots taken on a canonical device (for this application, iPad). I could not find any tools that would do something like this.

So what I really liked (1) is the tool that does this. But assuming I'm right if such a tool does not exist, is there (2) a library (preferably a Perl module, but I'm not so picky) that will read and display ePub?

Obviously, folding my own, I could combine tools for unpacking, reading html, reading xml, placing everyone in the correct order, and rendering html in certain constraints. Although I would prefer not to do this, and if this is the only option, I will have to look for a tool that will do the last part of it, or I will have to create it too.

Any leads to (1) or cannot (2)?

+4
source share
4 answers

I apologize if what I'm going to print is just crazy-talking on my part - in fact, I'm sure it is, but something like this may work, and I'm interested in knowing how well it can work for you:

Use Frank (https://github.com/moredip/Frank) to control iOS Simulator on Mac. Program it to open the EPUB documents you need.

All you need is what automates the taking of screenshots. Obviously, they will look like EPUBs that appear on the iPad (or iPhone, if you want), iOS Simulator does both, of course).

Screenshot automation could probably be done using AppleScript, although the tricky part might make him talk to Frank. In the worst case scenario, you can tell Frank to pause for 5 seconds after he loads every page and tells AppleScript to take a screenshot every five seconds. It sucks, but if you are desperate, it will be done. It is also possible that Frank might take screenshots in some way: I have not used it enough to know.

+4
source

Pandoc can convert from EPub to LaTeX (and therefore to PDF) or to any number of other formats. Conceptually, this should be a solution of type (1).

+1
source

depends on your definition of “look like” - you want custom chrome or just epub rendering for a given screen size.

I would look at the various epub readers for your platform of choice, the window size to your preferred size, and then just “print” the epub for a virtual printer that outputs image files - on windoze I use imageprint.

You can easily create a “frame” from an iPad product and put your screenshots in it. The only thing missing was, as I said, custom chrome.

0
source

You can try to convert EPUB to PDF first using PDFMate eBook Converter, and then convert PDF to IMG with PDFMate PDF Converter Free.

0
source

Source: https://habr.com/ru/post/1381774/


All Articles