[Ilugc] How to create cover images for all the ebooks in ProjectMadurai.org ?

  • From: tshrinivasan@xxxxxxxxx (Shrinivasan T)
  • Date: Tue, 29 Jul 2014 18:57:38 +0530

We are planning to convert all the ebooks in http://ProjectMadurai.org
as epub files, so that any one can read them on the latest devices
like andoid and ios devices.

We will be using http://pressbooks.com to convert them as ebub.
There are around 500 ebooks.

We are looking for volunteers to convert them all as epub and mobi.

In the meantime, They all need cover images.

On my request, sathia tried a rails app.

https://github.com/sathia27/project_madurai


But, it got unicode issue.

I tried using python to add a tamil text over a image.

The Tamil Text is displayed as splitted.

Sample Image: http://postimg.org/image/8z7ed377r/

http://comments.gmane.org/gmane.org.user-groups.linux.ilugc/84982



I too got the same issue what sathia gets.


Then, How to solve this?

This seems a great unicode issue and there is no programmable solution.

Here comes the power utilities of GNU/Linux.
when programming cant help much, shell can help.

There is a utility called "wkhtmltopdf" which can convert html as PDF.

Shall we create html pages with all the book name and author name details?
Then, we can convert as PDF.
Then, PDF to image.

Will it work?

I Installed wkhtmltopdf and tried.
In my latest ubuntu, wkhtmltopdf is installed, but it is too old.
Got some issues like "Not compiled with QT support".

We have to get the latest binaries from its website.

Download wkhtmltopdf from http://wkhtmltopdf.org/downloads.html

The websites gives latest binary with QT binding.
The one that comes with ubuntu in default is very old.

Download it from the site and install it.

It gives two utilities. 1. wkhtmltopdf  2. wkhtmltoimage

We use wkhtmltoimage to convert the html files into images.


Example :

wkhtmltoimage --height 640 --width 429  001.html 001.jpg




Using this method, we can convert all the html files to images directly.


Here is the detailed workflow:



1. Get all the book names,author name from
http://www.projectmadurai.org/pmworks.html

2. Copy them into a LibreOffice Calc spreadsheet.

3. Add serial number in a new front column.

4. Export as CSV file. Put $ as the delimeter.

5. Run the file parser.py

python parser.py


It will extract the book name, author and generate html files, with a
background image for the cover art.


6. Download wkhtmltopdf from http://wkhtmltopdf.org/downloads.html and install


7. Now, using a small shell script, we can convert all the html files
into images.

for i in *.html; do wkhtmltoimage --height 640 --width 429 $i
`basename $i .html`.jpg; done



Thats all.
We get all the images.


Background Image source:
http://pixabay.com/en/grey-background-texture-template-370125/
License     Public Domain CC0


Uploaded all the generated cover images here:
https://picasaweb.google.com/tshrinivasan/ProjectMaduraiCoverImages?noredirect=1


The source code repo:
https://github.com/tshrinivasan/project-madurai-cover-images



Now, we have all the cover images.
We need volunteers to work on creating ebooks for all the books on
http://ProjectMadurai.org

Contact me if you are interested in volunteering this.

Thanks.





-- 
Regards,
T.Shrinivasan


My Life with GNU/Linux : http://goinggnu.wordpress.com
Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com

Get CollabNet Subversion Edge :     http://www.collab.net/svnedge

Other related posts: