Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > PDF

Notices

Reply
 
Thread Tools Search this Thread
Old 08-10-2007, 04:23 PM   #1
IceHand
Linux User
IceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavens
 
IceHand's Avatar
 
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
manga2pdf - Linux bash scripts for the Cybook, Sony Reader and iLiad

Scripts updated on 28 February 2009
You may (re-)use these scripts under the terms of the CC-BY License.

This script will scan for ZIP- and RAR-files (including CBZ- and CBR-files) inside the current folder and inside subfolders (but not subsubfolders), optimize the images found in the archives and put them into PDFs inside a "CYBOOK Converted Manga", "SONY Converted Manga" or "ILIAD Converted Manga" folder (the title and content of the PDF will be the same as the archive).
If there already is a PDF inside the Converted Manga folder with the same name as the archive, the file will be skipped, e.g. if the file "CYBOOK Converted Manga/Megatokyo/MT_Chapter01.pdf" exists, the file "Megatokyo/MT_Chapter01.zip" will be skipped.
The script has the ability to halve double pages (two pages of a manga in one image). By default it's disabled, to activate it open the script and set "HalveDoublePages" to "1". The default is to use the standard manga orientation right-to-left, if you rename a folder to have the characters LTR at the very end (e.g. "Megatokyo LTR"), left-to-right orientation will be used. Of course the script will only halve images if the width is greater than the height and the size is greater than the size of the final resolution.
The script has also the ability to rotate double pages. By default it's disabled, to activate it open the script and set "RotateDoublePages" to "1" for 90° counter-clockwise rotation or "2" for 90° clockwise rotation. This does not work if halving of double pages is activated. Of course the script will only rotate images if the width is greater than the height and the size is greater than the size of the final resolution.

Requirements:
Bash compatible shell, ImageMagick, GIMP, libtiff (aka libtiff-tools), unzip, unrar.
ImageMagick version 6.3.2 or newer is needed for the -extent option to work properly, see posts at the end of the first page of this thread for further informations.

How to install it:
Move the colors4.gpl, colors8.gpl and colors16.gpl files into your GIMP palettes folder (usually "~/.gimp-2.4/palettes").
Move the batch-unsharp-mask-4.scm, batch-unsharp-mask-8.scm and batch-unsharp-mask-16.scm into your GIMP scripts folder (usually "~/.gimp-2.4/scripts")
Move the bash scripts that you need somewhere meaningful (e.g. "/usr/bin" or your Nautilus scripts folder "~/.gnome2/nautilus-scripts").

Note:
As you might have guessed there are three versions of this script, optimised for the Cybook (600x800, 4 colors), Sony Reader (570x760, 8 colors) and the Iliad (768x1024, 16 colors).
For the image optimization trimming will be used, if you don't want trimming, search for and remove "-fuzz "15%" -trim +repage".
The images will be sharpened and dithered using a GIMP script, as this gives better results than the ImageMagick functions.

Known issues:
- Will not work with sub-sub-sub-directories inside an archive (you'll get an error message)
- Only works with *.png, *.jpg and *.gif images (can be changed easily)

Changelog:
4.5.2 Support for CBZ- and CBR-files added.
Changed the order of the tiff2pdf command as it gave errors on a Mac. [link]
Removed some unnecessary lines of code.

4.5.1 Fixed a small bug that produced errors with filenames that begin with "-".

4.5 – Added the option to rotate double pages 90° counter-clockwise or clockwise

4.4 – Changed the the default dpi to 83 on the Cybook to allow zooming with the new firmware.
Added the option to change the dpi setting (at the top of the script), the default setting for Sony Reader is set to 166 and for the iLiad to 160. This should conform to 100% zoom. Please inform me if a different default setting would be better.

4.3 – The script will write to the file error.log if it encounters errors.
Added the option to stop the script from exiting on errors.
Check if all necessary programs are installed before running the script.

4.2 – Set the image density to 166dpi (Cybook, Reader) or 160dpi (iLiad). Has probably no effect on viewing with the Cybook and Sony Reader, but now the PDFs will correctly view with Evince and Xpdf too (haven't tested them with Adobe Reader).

4.1 – Fixed the internal name of the 8 color palette
Attached Files
File Type: zip manga2pdf-v4.5.2.zip (14.3 KB, 1354 views)

Last edited by IceHand; 02-28-2009 at 11:10 AM.
IceHand is offline   Reply With Quote
Old 08-11-2007, 07:21 AM   #2
IceHand
Linux User
IceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavens
 
IceHand's Avatar
 
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
Is there a better format to convert to than PDF? Simple ZIP-files should work on the Cybook and Iliad (I think), but not on the Reader. Is there an easy way to convert a bunch of images to LRF?

For Windows there seem to be better programs for this whole Manga2Ebook task, but unfortunatly not for Linux (don't know about the final image quality compared to this script though).

As I said, some feedback would be nice. Especially the 600x800 resolution for the Reader might not be optimal, because the device has a small bar at the bottom of the screen with the page number and stuff.
IceHand is offline   Reply With Quote
Advert
Old 08-11-2007, 10:43 AM   #3
Steven Lyle Jordan
Grand Sorcerer
Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.Steven Lyle Jordan ought to be getting tired of karma fortunes by now.
 
Steven Lyle Jordan's Avatar
 
Posts: 8,478
Karma: 5171130
Join Date: Jan 2006
Device: none
Book Designer allows you to turn images into LRF, and you can use as many as you want. If the image is sized to close to 600x800, the next image will simply jump to the next page. And as BD will generate page numbers for the LRF, you might not need the ones embedded into MegaTokyo.

To get the images into BD, you could try embedding them into a Word or HTML file, then importing that into BD. If I were you, I'd lower the resolution as much as possible, to bring down the file size.
Steven Lyle Jordan is offline   Reply With Quote
Old 08-11-2007, 10:49 AM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,887
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Also, PDF is a bad idea. Please, no PDF.
JSWolf is offline   Reply With Quote
Old 08-11-2007, 11:27 AM   #5
IceHand
Linux User
IceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavens
 
IceHand's Avatar
 
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
Book Designer is a Windows program, isn't it? And even if it would work with Linux, I would prefer a command line tool for batch processing. But thanks for the suggestion anyway.
And when you say "lower the resolution as much as possible" how big is the viewable resolution of the Reader?
IceHand is offline   Reply With Quote
Advert
Old 08-11-2007, 12:49 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
comic2lrf
kovidgoyal is offline   Reply With Quote
Old 08-12-2007, 02:10 PM   #7
athlonkmf
Guru
athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.
 
Posts: 714
Karma: 1014039
Join Date: May 2007
Device: Sony PRS-500, Sony PRS-505, Kindle 3, Sony PRS350, iPad 64GB
Quote:
Originally Posted by JSWolf View Post
Also, PDF is a bad idea. Please, no PDF.
PDF is a good idea if you take the target-device into consideration.

I made Manga2Ebook (the windows version) to create PDF files because it can then be converted to other formats with the appropiate tools. Not to mention, a rasterized PDF-page is smaller than compressing an image directly into lrf.
athlonkmf is offline   Reply With Quote
Old 08-12-2007, 02:12 PM   #8
athlonkmf
Guru
athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.
 
Posts: 714
Karma: 1014039
Join Date: May 2007
Device: Sony PRS-500, Sony PRS-505, Kindle 3, Sony PRS350, iPad 64GB
Quote:
Originally Posted by IceHand View Post
Is there a better format to convert to than PDF? Simple ZIP-files should work on the Cybook and Iliad (I think), but not on the Reader. Is there an easy way to convert a bunch of images to LRF?

For Windows there seem to be better programs for this whole Manga2Ebook task, but unfortunatly not for Linux (don't know about the final image quality compared to this script though).

As I said, some feedback would be nice. Especially the 600x800 resolution for the Reader might not be optimal, because the device has a small bar at the bottom of the screen with the page number and stuff.

Use 570x760. Be sure that the PDF is in that format too.
athlonkmf is offline   Reply With Quote
Old 08-12-2007, 02:48 PM   #9
IceHand
Linux User
IceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavens
 
IceHand's Avatar
 
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
Thanks for the input, I will change that in the script. One question though: Why the width of 570px? I can understand the height of 760px (because of the bar at the bottom), but why can't the whole width of the screen be used?
Anyway, I will make some more adjustments as soon as I have a Cybook. Btw, is there any chance that you will release a Linux version of Manga2Ebook?
IceHand is offline   Reply With Quote
Old 08-12-2007, 06:03 PM   #10
athlonkmf
Guru
athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.
 
Posts: 714
Karma: 1014039
Join Date: May 2007
Device: Sony PRS-500, Sony PRS-505, Kindle 3, Sony PRS350, iPad 64GB
Quote:
Originally Posted by IceHand View Post
Thanks for the input, I will change that in the script. One question though: Why the width of 570px? I can understand the height of 760px (because of the bar at the bottom), but why can't the whole width of the screen be used?
Anyway, I will make some more adjustments as soon as I have a Cybook. Btw, is there any chance that you will release a Linux version of Manga2Ebook?
The width is to make sure the page is in a 4:3-ratio, otherwise the Reader will use ugly big margins to display things.

As for a linux version, i'm not sure. If the initial version was succesful enough, i might have considered going for a java-based solution. Unfortunately there wasn't much response. So I just made something that suits my needs. I managed to write the .NET-version in a week, so I did that.
athlonkmf is offline   Reply With Quote
Old 04-03-2008, 01:35 AM   #11
sealbeater
Banned
sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.
 
Posts: 666
Karma: 1752814
Join Date: Jan 2008
Device: Sony Reader PRS-505 : Onyx Boox Max : Sony PRS-900 : Onyx Kepler Pro
Wow, this is exactly what I've been looking for. Quick question or two, how can I specify the 8 scale option, and what does the -extent option to convert do, my version didn't have it but it may be old so I'll try again with a newer version, but thanks a lot for this, I really appriciate it.
sealbeater is offline   Reply With Quote
Old 04-03-2008, 06:43 AM   #12
IceHand
Linux User
IceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavens
 
IceHand's Avatar
 
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
Quote:
Originally Posted by sealbeater View Post
Wow, this is exactly what I've been looking for. Quick question or two, how can I specify the 8 scale option, and what does the -extent option to convert do, my version didn't have it but it may be old so I'll try again with a newer version, but thanks a lot for this, I really appriciate it.
Oh yeah, I forgot to update the scripts. Download the new version and you'll find an optimised version for the new Sony Reader (8 colors). Be sure to read the new description as I've changed some things.

The -extent option extends the image to a specified size with a white border, e.g. after resizing an image the size might be 526x760, but it will be extended with a white border to 570x760 so that every image has exactly the same size. If you don't do that the PDF might get screwed up.

EDIT: The 8 color palette was named wrong. Please download the new 4.1 version to get the Sony Reader script working.

Last edited by IceHand; 04-04-2008 at 11:07 AM.
IceHand is offline   Reply With Quote
Old 04-04-2008, 04:09 PM   #13
sealbeater
Banned
sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.
 
Posts: 666
Karma: 1752814
Join Date: Jan 2008
Device: Sony Reader PRS-505 : Onyx Boox Max : Sony PRS-900 : Onyx Kepler Pro
Awesome, awesome, thank you!!
sealbeater is offline   Reply With Quote
Old 04-05-2008, 06:14 AM   #14
IceHand
Linux User
IceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavensIceHand is a rising star in the heavens
 
IceHand's Avatar
 
Posts: 323
Karma: 13682
Join Date: Aug 2007
Location: Germany
Device: Kindle 3
You're welcome.
Please let me know, if the created PDFs give any problems on the Sony Reader. I could only test the PDFs on my Cybook.
IceHand is offline   Reply With Quote
Old 04-18-2008, 03:01 PM   #15
sealbeater
Banned
sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.sealbeater ought to be getting tired of karma fortunes by now.
 
Posts: 666
Karma: 1752814
Join Date: Jan 2008
Device: Sony Reader PRS-505 : Onyx Boox Max : Sony PRS-900 : Onyx Kepler Pro
I've tested it out and it works perfectly! This is what it's supposed to be about, the *nix way, many thanks again, that java app was killing me.
sealbeater is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripts or command-line utilities for simplifying HTML (linux preferred) rogue_ronin Other formats 2 05-15-2009 10:51 AM
Imp scripts and wine linux related derrell Fictionwise eBookwise 12 10-31-2008 04:53 PM
sony reader, cybook, or iliad reader , help plz waddragon Which one should I buy? 1 02-03-2008 12:25 PM
PRS-500 Sony Reader Linux sources updated Alexander Turcic Sony Reader Dev Corner 4 02-03-2007 08:31 PM
Scripts to move comics to Iliad e-ink reader Bob Russell iRex 26 10-05-2006 11:08 AM


All times are GMT -4. The time now is 11:41 PM.


MobileRead.com is a privately owned, operated and funded community.