Canti
@author: Andrew Mantel
@version: 1.72

----------------------------------------------------------------------
-Instructions-
1) Install ImageMagick. ImageMagick is free software used for image manipulation and can be downloaded from http://www.imagemagick.org/script/binary-releases.php
2) Create a default ConvertManga.properties file for your device/os by running the command:
   java -jar ConvertManga.jar -create_device [device name]
   (For a list of acceptable device names, run the program without any options: java -jar ConvertManga.jar)
3) Edit ConvertManga.properties file to suit your needs. The default values are based on whatever os you are running and the [device name] you specified in Step 2.
4) Open a command prompt to the folder containing ConvertManga.jar and .properties. Run:
   java -jar ConvertManga.jar
   This will give you a list of the commands you will need to specify to run the program. Here is an example of running the program:
   java -jar ConvertManga.jar -parent_folder /home/[user_name]/Manga/School_Rumble/ -prefix "School Rumble - Ch." -output_folder /home/[user_name]/Manga_Kindle/School_Rumble/

   There are several values you can use for -parent_folder:
   1. A single folder of image scans
   2. A single .zip/.cbz/.rar/.cbr archive of image scans
   3. For processing a lot of manga at once, you can organize your manga like this:
      Manga_Title  <-- this is the folder you would specify as -parent_folder
        Blah_blah_001    <-- this is a folder or .zip/.cbz/.rar/.cbr holding the image scans for chapter 1
        Blah_blah_002    <-- this is a folder or .zip/.cbz/.rar/.cbr holding the image scans for chapter 2
        ...
        Blah_blah_999    <-- this is a folder or .zip/.cbz/.rar/.cbr holding the image scans for chapter 999
5) Let the program run. Depending on how much manga you have and the speed of your computer it may take some time to finish. It will give you a time estimate based on how much work it has done and it much work is left to do.


Note:
I wrote this program for fun and for my own personal use, but decided to release it publicly so that all manga/comic lovers could use it.
It works great to process manga for my Kindle DX and iPad. I hope you enjoy!

I HIGHLY recommend using pdf for manga on the Kindle DX.
For the iPad, I recommend cbz manga and a comic reading app (I use ComicZeal).

----------------------------------------------------------------------
-Update History-
New to version 1.72:
-.rar/.cbr support
Canti now supports .rar/.cbr input and output files.
Because rar is a proprietary format, Canti cannot simply read or write a rar file itself. It relies on your system having a rar handler already installed.
For unrar support, make sure you have installed one of the following:
  For Linux/Unix: rar, unrar, unrar-nonfree
  For Windows: WinRAR (installed to [drive_letter]:\Program Files\[folder with "rar" in its name, such as WinRAR]\)
  For Mac: rar
For rar support, make sure you have installed one of the following:
  For Linux/Unix: rar
  For Windows: WinRAR (installed to [drive_letter]:\Program Files\[folder with "rar" in its name, such as WinRAR]\)
  For Mac: rar
Note that the .properties file has changed. Instead of @zip and @zip_format, there is now @archive and @archive_format. @archive_format can be set to .zip, .cbz, .rar, or .cbr
This is set up in the .properties file.
-Archive input image folders
For a long time I've had my manga scans organized as image folders, but since Canti can handle input archive files I've added this new feature.
If it is enabled then all input image folders will be archived (using whatever format you set as archive_format, either .zip/.cbz/.rar/.cbr) and the folders will be deleted.
This will keep the file system cleaner since it reduces thousands of image files to a collection of zip archives.
This is set up in the .properties file.
-Other tweaks
I don't remember all the little stuff I changed, just know that the latest release of Canti is always the best version to use.
To give you an idea of Canti's growth:
  # lines of code in Canti v1.1a: ~1600
  # lines of code in Canti v1.72: ~3900

New to version 1.71:
Special notice: The default ConvertManga.properties file will no longer be included when you download the program. Instead, you must create a default .properties file for your device/os using the new feature listed below.
                Make sure to make the default .properties file before processing any manga. Also make sure to read through the default .properties file and make any changes to match your individual needs.
-Default .properties file creator
Will create a default ConvertManga.properties file for the device you specify.
This is run by calling: java -jar ConvertManga.jar -create_properties [device name]
Current list of acceptable [device name] values: kdx, k2, ipad
Note that this will attempt to determine your ImageMagick install directory based on what operating system your are using.
  >For unix/linux or mac it uses default locations.
  >For windows it will search "Program Files" directories of all local disks. You may have to manually correct this value if the program fails to find this install directory for you.
-Improved reprocessing intelligence
Verifies folders listed in progress.txt (i.e. the folders which were previously processed) and removes an entry if the folder no longer exists. Of course zip restoration is performed before verifying the progress folder in case you have del_output_image_folders turned on.
Also, zip restoration will only be performed on archives relative to the current processing (so if there are other archives in the ouput folder, Canti won't waste time restoring them).

New to version 1.7:
-Source files in zip/cbz format
Program can now process manga located in -parent_folder in .zip or .cbz format.
You can also set -parent_folder to be a .zip or .cbz file.
Note that this will only process the images in the root of the archived file, so if you have an archive with multiple levels of subfolders then the images in those folders won't be processed.
-Delete output image folders after processing
This feature can only be used if:
  1) You output zip/cbz archives as these will allow the program to temporarily recreate the output image folders in case you need to process the same manga again (a big time saver)
  2) Binding (either through bind file or auto-binding) is disabled
This is set up in the .properties file.
-Pdf page/bind ordering from right to left
Same as epub right to left feature introduced in v1.61, now for pdf.
This is set up in the .properties file.

New to version 1.61:
-Epub works in iBooks
Epub is finally out of beta and the output epub files can be synced through iTunes and read in iBooks.
I do not recommend epubs for manga though... a good portion of the screen is used by the virtual book, you can't zoom in on images,
and iBooks sometimes sizes the images wrong (especially when switching from 2-page to single-page view, the image may remain at the smaller 2-page size).
-Epub page/bind ordering from right to left
Hehe, this is a cool feature to try out in iBooks. By turning this option on, the ordering of the output epub will resemble that of manga (i.e. pages and bindings will be ordered right to left).
Currently iBooks automatically loads page 1 of the epub, so if you use this feature you will have to either use the page slider to jump to the last page or (if you used binding) load the first chapter from the table of contents.
Kinda fun to see the virtual iBook with proper manga ordering :)
This is set up in the .properties file.

New to version 1.6:
-Auto sense suffix
By not setting (or setting to -1) the -num_chars_keep_suffix value, the program will attempt to automatically determine the suffixes of your manga folders.
Note that each manga folder must end with a number such as 1, 001, 1.11, or 001.11 for this to work.
-Output base folder
Instead of specifying -output_folder at runtime, can specify an output base folder in the .properties file.
If the value is set to "default", then the output_base_folder will be: one directory up from -parent_folder/OUT/
If this value is set to [path to output base folder], then the output_base_folder will be: [path to output base folder]/[manga title]/
Acceptable values: default, [path to output base folder]
For Linux systems, [path to output base folder] should be something like /home/[username]/Manga/IPAD/
For Windows systems, [path to output base folder] should be something like C:\\Manga\\IPAD\\
Note that [path to output base folder] cannot contain any spaces.
-ComicZeal naming
For iPad users who read manga using ComicZeal (like me), this option uses a special ComicZeal naming scheme for the zip archives.
It places the title of the manga at the beginning of the filename, followed by a ~ (for example: School_Rumble~School_Rumble_-_Ch.001).
When ComicZeal imports these specially named files it will automatically sort the manga into the correct collections.
This is set up in the .properties file.

New to version 1.5:
My parents surprised me with an iPad (they are awesome!), so now I have one to test manga on.
Manga looks great on the iPad, and I've changed the defaults in the .properties file to reflect the best settings for the iPad.
Also, for iPad users I recommend getting a reader app such as Goodreader for pdf manga, or better yet ComicZeal for cbz manga (that's what I use).
-Single folder mode
Instead of batch processing a collection of organized manga folders, you can specify a single folder to process.
This works transparent to the user. When you specify -parent_folder it checks whether there are subfolders (batch mode) or not (single folder mode) and then continues working accordingly.
-Full size images
Instead of specifying a width and height to resize images to, now you can leave the images the same size as the source images.
I recommend using this setting for the iPad since the larger images are better to zoom on, and the iPad makes it easy to zoom on images.
This is set up in the .properties file by setting "width" and/or "height" to -1
-Can disable auto rotate for portrait images
Before I had portrait images automatically rotated to landscape mode by default, but now you can turn this off if you want.
This is set up in the .properties file.
-Binding for epub
Now you can bind multiple manga folders into a single epub.
Note that epub is still in BETA. I can sync the epubs using iTunes, but I can't get them to appear in iBooks. If you know how to fix this please pm me on mobileread.com (username "lilman").

New to version 1.4a:
Fixed an error in the toc.ncx file of the epubs.

New to version 1.4:
-Epub
This is in BETA! I do not have an iPad and so I have no idea how this will look on one.
I wanted to add epub support so that you could add your manga to your iTunes library, making it easier to sync (and also so you could view it in iBooks).
This is my first experience with epubs and I wrote the code from reading epub tutorials online. A lot of this is guess work and therefore will most likely not work perfectly.
If you have any epub experience and know how to make these epubs work better on the ipad, please pm me on mobileread.com (my username is lilman). Thanks!
This is set up in the .properties file.
Note that there is no binding support for epubs yet.
-Bug fix: Fixed changing page_filename_length after processing manga will correctly rename image filenames when binding (I know, you probably would have never noticed this, but I did and it bothered me :P)

New to version 1.3:
-Auto-Binding
Same as binding, except you don't create a bind file. Instead, you just specify a single size for all bindings (for example, all bindings could have 10 folders in them).
This is set up in the .properties file.

New to version 1.2:
-Binding
Binding allows you to easily combine chapters into volumes while still keeping your original manga chapter folders intact.
See the included bind.txt for instructions on setting up a bind file.
-Can specify zip format (either .zip or .cbz)
I figured some comic programs might like the .cbz extension better. This option is set in the .properties file.
-Changed command line parameters
I changed some of the command line parameters, so run 'java -jar ConvertManga.jar' to see the list of new commands.
-Other random tweaks
I rewrote a good chunk of the code. Lots of error handling and other nice stuff. For example, let's say you already converted a lot of manga but
you added a few more chapters to your collection. The program is smart enough not to reprocess manga that has already been processed (a big timesaver).

New to version 1.1a:
Fixed the grayscale not working bug.

New to version 1.1:
Since the iPad is about to come out, I made some small changes to the program to accomodate the new shiny device.
-Added support to .properties file for specifying color or grayscale of output images.
-Added support to .properties file for specifying number of colors of output images, or not limiting the range of colors at all.
Also, I got tired of calling this "my manga processing program" so I'm giving it a name: Canti, after the Medical Mechanica robot from FLCL. So anyway, enjoy Canti version 1.1.
