Skip to content

Tutorial: Input Arguments

bajuwa edited this page Apr 25, 2020 · 7 revisions

Table of Contents

Input/Output Directories

These settings will tell Comic Compiler where to find the input images for your chapter and where to put the stitched pages when it's done.

Input Files

Shorthand: -f [Path (space separated for multiple)]
Longhand: --input-files [Path (space separated for multiple)]
Default: "image*.jpg"
GUI: Using "Import Folder" will use wildcards to use all files within the selected folder as input. If you only want a specific set of files from a given folder, use "Import Files" instead. After using the file picker, you can always manually modify the text in the input/output fields before running.

Will only combine files that match the given list of file names or regex patterns. Regex is resolved via pythons glob.glob method.

Examples:

  • comicom.py -f ./image*.jpg will combine all files in your current directory that start with "image" and have the ".jpg" extension
  • comicom.py -f ./image000.jpg ./image001.jpg ./image002.jpg will only combine the three images given, if they exist in the current directory.
  • comicom.py -f ./part1/*.jpg ./part2/*.jpg ./part3/*.jpg will only combine all jpg images found in the 3 folders part1, part2, part3.
  • comicom.py -f ./image00[0-9].jpg ./image011.jpg will only combine the images numbered 000-009 as well as 011, if they exist in the current directory.

Disable Input Sort

Shorthand:
Longhand: --disable-input-sort
Default: False
GUI: This is not yet available in the GUI version

If this value is present, then the program will not try to sort the input images and will process them in the exact order they are given/resolved.

Examples:

  • comicom.py -f ./image3.jpg ./image2.jpg ./image1.jpg will combine the images in 1-2-3 order.
  • comicom.py -f ./image3.jpg ./image2.jpg ./image1.jpg --disable-input-sort will combine the images in 3-2-1 order.

Input File Name Prefix

Shorthand: -i [Path]
Longhand: --input-file-prefix [Path]
Default: "image"
GUI:

[DEPRECATED] Use the Input Files parameter instead
Will only combine images that start with this text.

Examples:

  • comcom -i image If your input directory contains image001.jpg image002.jpg and test.jpg, only image001.jpg and image002.jpg will be combined in to the final page file.

Input Directory

Shorthand: -id [Path]
Longhand: --input-directory [Path]
Default: "./"
GUI:

[DEPRECATED] Use the Input Files parameter instead
The path to the directory you want to collect image files from. By default it's set to "./" which refers to your current working directory, aka the location you're in when you run the script.

Output Directory

Shorthand: -od [Path]
Longhand: --output-directory [Path]
Default: "./Compiled/"
GUI: Use "Browse" to pick the output folder you'd like to use, or manually type the folder path. If the folder doesn't exist before running the compilation, the folder will be made for you. After using the file picker, you can always manually modify the text in the output directory field before running.

The path to the directory you want to put the new page files in. By default it's set to "./Compiled/" which will create a new folder called 'Compiled' in your current working directory, aka the location you're in when you run the script, and put your generated pages in that folder.

Output Page Settings

These settings will control what the final pages look like once stitched together.

Output Page File Prefix

Shorthand: -o [text]
Longhand: --output-file-prefix [text]
Default: "page"
GUI:

The text that will go at the start of each output page name. The prefix is followed by a 3 digit number (zero-padded page number) and the File Extension that was set that matches the input image file types.

Output Page Starting Number

Shorthand: -osn [integer]
Longhand: --output-file-starting-number [integer]
Default: 1
GUI:

The number of the first output page.

File Extension

Shorthand: -e [text]
Longhand: --extension [text]
Default: ".jpg"
GUI:

The file extension of your output page files.

Output Page Width

Shorthand: -ow [integer]
Longhand: --output-file-width [integer]
Default: [First input images width]
GUI:

The explicit width of the output pages. If no value is given, or a value of 0 is given, then the output pages will be the same width as the first input image. Note: This will modify your input images. If you want to avoid losing your original copies then make a backup of them prior to running comcom.

Minimum Height Per Page

Shorthand: Before v1.2: -m [integer]
After v1.2: -m [Pixel, Ratio, Fraction, or Percent]
Longhand: Before v1.2: --min-height-per-page [integer]
After v1.2: --min-height-per-page [Pixel, Ratio, Fraction, or Percent]
Default: 5000px
GUI:

The minimum allowed pixel height per page. When combining images, the script will not start looking for a breakpoint until it has first hit this height requirement.
Ratio is determined as "width by height", therefore a ratio of 1:10 will produce pages that are at least 10 times as high as they are wide. Fractions/Percents are determine by the cumulative image height, therefore a minimum height of 20% or 1/5 will produce roughly 4-5 pages as each page will be at least 1/5 of the height of all the resulting pages.

Minimum Height Last Page

Shorthand: -M [Pixel, Ratio, Fraction, or Percent]
Longhand: --min-height-last-page [Pixel, Ratio, Fraction, or Percent]
Default: 2000px
GUI:

The minimum allowed pixel height for the last compiled page. This means that if the final compiled page is less than this specified value, then it will be combined with the second to last page.

Breakpoint Settings

These settings will control how Comic Compiler searches for 'breakpoints' within the pages. Breakpoints are the places in the comic that would make good locations to split pages without cutting across text.

Breakpoint Detection Mode

Shorthand: -b [integer]
Longhand: --breakpoint-detection-mode [integer]
Default: Before v1.2 0 ("End of File")
After v1.2 -1 ("Let Comicom Decide")
GUI:

The "mode" that the script uses to detect where to split up pages. In general, the script will continue to combine images until it reaches your specified Minimum Height Per Page requirement. After that requirement is hit, it will then start looking for breakpoints. This mode setting controls how the script tries to find these breakpoints.
Mode -1 (Let Comicom Decide): This 'mode' simply performs some extra preprocessing on the input images to determine which of the other modes will compile the most accurate result in the least amount of time.
Mode 0 (End of File): This is the simplest mode and runs the fastest. It will try to break pages when it adds an image that ends in a single line of the breakpoint colour. This means that if your series of images often split panels across images, you will likely generate randomly long page files. If that's the case, then use mode 1 instead.
Mode 1 (Dynamic Search): This is a more complex algorithm that could take a bit longer as it may need to search the entire image for a breakpoint instead of just the last line of the file. While this mode takes longer, it often produces more consistent page sizes as it can better handle long unbroken panels or images that don't neatly cut between panels.

Breakpoint Buffer

Shorthand: -bb [Pixel or Percent]
Longhand: --breakpoint-buffer [Pixel or Percent]
Default: 20px
GUI:

When in Breakpoint Detection Mode #1 (Dynamic Search) this value controls how much additional 'breakpoint space' will be left on the previous page before slicing. By default this means that it will try to leave at least 20px of extra whitespace at the bottom of any given page. If there isn't as much whitespace as your given buffer value, it will break with the end of the current patch of whitespace. If it reaches the end of an image before it finds the 'end' of the current patch of whitespace, it will cut at the end of the file and not continue searching through the next image.

Breakpoint Row Check Increments

Shorthand: -bi [integer]
Longhand: --break-points-increment [integer]
Default: 10
GUI: This is not available in the GUI version

When in Breakpoint Detection Mode #1 (Dynamic Search) this value controls how often the script tests a line in an image file for a breakpoint. Increasing this value will make the script run faster, but may cause smaller gaps to be missed when trying to split. Reducing the value will do the opposite: script runs slower but will more reliably detect smaller gaps between panels.

Examples:

  • comcom -m 1 -bi 10 will check row 0 for a breakpoint, then row 10, then row 20, until it either finds a breakpoint or reaches the end of the file.

Breakpoint Row Check Multiplier

Shorthand: -bm [integer]
Longhand: --break-points-multiplier [integer]
Default: 20
GUI: This is not available in the GUI version

When in Breakpoint Detection Mode #1 (Dynamic Search) this value controls how large of a vertical area is pre-tested for a breakpoint before iterating over rows via Breakpoint Row Check Increments. Note: When increasing/decreasing the Check Increments value, consider decreasing/increasing the Check Multiplier such that you stay in a range close to 200-300 pixels, otherwise you may lose performance benefits.

Examples:

  • comcom -m 1 -bi 10 -bm 20 will first check a vertical strip down the center of the image that's 200 pixels tall (where bi of 10 times bm of 20 equals 200). If this 200 pixel space doesn't contain any breakpoints then the script will skip that area and check the next area of 200 pixels. This value can help reduce the number of horizontal rows tested which will reduce script run time.

Split Pages on Colours

Shorthand: -c [space separated list of integers]
Longhand: --split-on-colour [space separated list of integers]
Default: 0 [pure black] and 65535 [pure white]
GUI:

The decimal notation of the grayscale colour you want to split on. Use 65535 for white (which is the default), 0 for black, or any number in that range for your intended colour.
Note: This argument explicitly sets the colours you want to break on, overriding the previous values.

Examples:

  • comcom -c 123 will use the colour 123 instead of 0 and 65535

Split Pages on Additional Colours

Shorthand: -C [space separated list of integers]
Longhand: --additional-split-on-colour [space separated list of integers]
Default: none
GUI: This is not included in the GUI as you can directly change the original [Split Pages on Colours](#split-pages-on-colours) values instead.

Adds an additional decimal notation colour you want to split on.
Note: This argument will add a single new colour to the list of colours you want to break on. You can add as many colours as you want by adding more -C arguments.

Examples:

  • comcom -C 123 456 789 will use the colours: 0, 65535, 123, 456, 789 (where 0 and 65535 came from the original default values)
  • comcom -c 123 456 789 will use the colours: 123, 456, 789

Colour Split Error Tolerance

Shorthand: -ce [integer]
Longhand: --colour-error-tolerance [integer]
Default: 0
GUI:

If the images breakpoints aren't always the exact same shade of your specified colour, increasing this value will allow Comic Compiler to split of colours that are 'close' to the ones you've specified. Regardless of this error tolerance, the entire horizontal line must still be a solid colour. When changing this value, take in to account these are error tolerances on the decimal notation of the colour, ie 0 for black and 65355 for white.

Examples:

Colour Split Standard Deviation

Shorthand: -csd [integer]
Longhand: --colour-standard-deviation [integer]
Default: 0
GUI:

If the images aren't always the exact same colour but are often within a range of colours, change this value to allow for more variance in what decimal colour values are 'accepted' to split by. The higher this value, the more 'noise' is allowed in the breakpoints. Note: In order to use standard deviation, you must also use a colour error tolerance that is higher than the standard deviation value.

Examples:

  • comicom.py -ce 10000 -csd 3000 will use white and black as it's default breakpoint colours, with an 'error tolerance' that will allow light grays and dark grays to be included. With the standard deviation of 3000 it will allow the breakpoint to be a variety of grays instead of requiring a completely solid line of gray. See this test case for more visual examples.

Extra Settings

These settings will not necessarily change the compilation process itself, but they can activate small convenience features.

Logging Mode

Shorthand: -l [integer]
Longhand: --logging-mode [integer], --error, --info, --warn, --debug, --verbose
Default: Before v1.2 Info
After v1.2 Warn
GUI: This is available as a dropdown menu that selects based on text instead of level number:
Before v1.2 Info, Debug, Verbose
After v1.2: Error, Info, Warn, Debug, Verbose

Controls how much text is output to the console while the script is running. Mode 0 only reports the bare minimum of which image range was compiled into which page file. Mode 1 (aka debug) reports additional info that describes which broad 'decisions' were made during the scripts execution. Mode 2 (aka verbose) will report everything in debug mode as well as specific data values that lead to the script decisions.

Examples:

  • Before v1.2: comcom -l 1 is equivalent to comcom --debug and comcom -l 2 is equivalent to comcom --verbose
  • After v1.2: comcom -l 3 is equivalent to comcom --debug and comcom -l 4 is equivalent to comcom --verbose

Confirm Exit

Shorthand: -x
Longhand:
Default: unset/False
GUI: This is not available in the GUI version as it is only relevant to command terminal prompts opened during the course of other scripts.

If set, when the program finishes compiling it will prompt you to press enter before terminating itself. This can be useful if you've triggered comcom through other means and don't want the pop up terminal to close immediately after it's done.

Clean Output Directory

Shorthand:
Longhand: --clean
Default: unset/False
GUI:

If set, before the new pages are compiled the program will delete the configured output directory. This is good if you're reattempting a comcom command and don't want to mix the new pages with the old.

Open On Complete

Shorthand:
Longhand: --open
Default: unset/False
GUI:

If set, after the new pages are compiled the program will open the directory it was working in via windows explorer.

Sort Input Files

Shorthand:
Longhand: --disable-input-sort
Default: unset/False
GUI:

By default, input images will be sorted prior to compilation as it's assumed they're in numbered order. If you want to compile in the specific order given, then set this flag or uncheck it in the GUI.

Abort On Stich Mismatch

Shorthand:
Longhand: --enable-stitch-check
Default: unset/False
GUI:

If this value is set, then compilation will abort prior to creating any pages if it finds two consecutive input images that don't appear to start/end in the same series of pixels. When images mismatch in this fashion, it could imply that an input image is missing, or a credit page was included.

GUI Presets

The ComGUI has a few extra things available for user convenience. While these features exist only in the GUI, the effects they create can still be replicated via CLI (and will be noted in each section).

Profiles

Profiles are basically a series of configurations that you can save/load whenever you need to reuse them. These are good to use if you are consistantly using the same settings for a particular series/group/environment and don't wish to reinput the values every time you open Comicom.
CLI Equivalent: The CLI can replicate this behaviour using features available to your system. Examples include aliases, bash scripts, other python scripts, etc.

Colour Presets

Colour presets are a quick way to input the breakpoint colour values you may need to use to get certain breakpoint effects. While the default colour settings for "Solid Black/White" are usually sufficient for most art styles, sometimes you may not have easily defined solid breakpoints and may need to use presets like "Non-solid Colour" in order to try to break on areas that are transitioning between art scenes.
CLI Equivalent: The CLI can replicate this behaviour by simply inputing the colour values directly as arguments, as follows:

Preset Name Split on Colours -c Colour Error -ce Colour St. Dev. -csd
Solid Black/White (default) 0 65535 0 0
Any Solid Colour 0 65535 0
Non-solid B/W 0 65535 10000 1000
Non-solid Colour 0 65535 1000

Formats

Some arguments will allow for special input formats instead of the standard integer or text.

Format Name Pattern Examples
Path C:/path/to/my/images/, C:/path/to/my/images/image.jpg, "C:/path/to/my images/"
Pixels [0-9]+(px) 100, 100px
Ratio [0-9]+:[0-9]+ 1:1, 1:5, 2:5
Fraction [0-9]+/[0-9]+ 1/2, 1/5
Percent [0-9]{1-3}% 0%, 42%, 100%

Clone this wiki locally