Comande line interfaces

dns-ipv6-prefix.py

Get the ipv6 prefix from a DNS name.

usage: dns-ipv6-prefix.py [-h] [-V] dnsname

Positional Arguments

dnsname The DNS name, e. g. josef-friedrich.de

Named Arguments

-V, --version show program’s version number and exit

extract-pdftext.py

usage: extract-pdftext.py [-h] [-c] [-v] [-V] file

Positional Arguments

file A PDF file containing text

Named Arguments

-c, --colorize

Colorize the terminal output.

Default: False

-v, --verbose

Make the command line output more verbose.

Default: False

-V, --version show program’s version number and exit

find-dupes-by-size.py

Find duplicate files by size.

usage: find-dupes-by-size.py [-h] [-V] path

Positional Arguments

path A directory to recursively search for duplicate files.

Named Arguments

-V, --version show program’s version number and exit

list-files.py

This is a script to demonstrate the list_files() function in this file.

list-files.py a.txt list-files.py a.txt b.txt c.txt list-files.py (asterisk).txt list-files.py “(asterisk).txt” list-files.py dir/ list-files.py “dir/(asterisk).txt”

usage: list-files.py [-h] [-V] input_files [input_files ...]

Positional Arguments

input_files Examples for this arguments are: “a.txt”, “a.txt b.txt c.txt”, “(asterisk).txt”, “”(asterisk).txt””, “dir/”, “”dir/(asterisk).txt””

Named Arguments

-V, --version show program’s version number and exit

mac-to-eui64.py

Convert mac addresses to EUI64 ipv6 addresses.

usage: mac-to-eui64.py [-h] [-V] mac prefix

Positional Arguments

mac The mac address.
prefix The ipv6 /64 prefix.

Named Arguments

-V, --version show program’s version number and exit

pdf-compress.py

Convert and compress PDF scans. Make scans suitable for imslp.org (International Music Score Library Project). See also http://imslp.org/wiki/IMSLP:Musiknoten_beisteuern. The output files are monochrome bitmap images at a resolution of 600 dpi and the compression format CCITT group 4.

usage: pdf-compress.py [-h] [-c] [-m] [-N] [-v] [-V]
                       {convert,con,c,extract,ex,e,join,jn,j,samples,sp,s,unify,un,u}
                       ...

Positional Arguments

subcommand

Possible choices: convert, con, c, extract, ex, e, join, jn, j, samples, sp, s, unify, un, u

Subcommand

Named Arguments

-c, --colorize

Colorize the terminal output.

Default: False

-m, --multiprocessing
 

Use multiprocessing to run commands in parallel.

Default: False

-N, --no-cleanup
 

Don’t clean up the temporary files.

Default: False

-v, --verbose

Make the command line output more verbose.

Default: False

-V, --version show program’s version number and exit

Sub-commands:

convert (con, c)

Convert scanned images (can be many image file formats or a PDF files) in monochrome bitmap images. The resulting images are compressed using the CCITT group 4 compression.

pdf-compress.py convert [-h] [-a | -C | -P] [-b] [--blur BLUR] [-B] [-c] [-d]
                        [-e] [-f] [-j] [-o]
                        [-l OCR_LANGUAGE [OCR_LANGUAGE ...]] [-p] [-n]
                        [-q QUALITY] [-r] [-t THRESHOLD] [-T] [-u]
                        input_files [input_files ...]
Positional Arguments
input_files
a.tiff a.tiff b.tiff c.tiff (asterisk).tiff “(asterisk).tiff” dir/ “dir/(asterisk).tiff”
Named Arguments
-a, --auto-black-white
 

The same as “–deskew –join –ocr –pdf –resize –trim –unify”

Default: False

-C, --auto-color
 

The same as “–color –deskew –join –ocr –pdf –resize –trim –unify”

Default: False

-P, --auto-png

The same as “–deskew –resize –trim”

Default: False

-b, --backup

Backup original images (add _backup.ext to filename).

Default: False

--blur

Blur images for better jpeg2000 compression rate.

Default: False

-B, --border

Frame the images with a white border.

Default: False

-c, --color

The input files are colored images.

Default: False

-d, --deskew

Straighten the images.

Default: False

-e, --enlighten-border
 

Enlighten the border.

Default: False

-f, --force

Overwrite the output file even if it exists and it seems to be already converted.

Default: False

-j, --join

Join single paged PDF files to one PDF file. This option takes only effect with the option –pdf.

Default: False

-o, --ocr

Perform optical character recognition (OCR) on the input files.The output format must be PDF.

Default: False

-l, --ocr-language
 Run tesseract –list-langs to get your installed languages.
-p, --pdf

Generate a PDF file.

Default: False

-n, --png

Generate a PNG file.

Default: False

-q, --quality

Compress the input images in a specific quality. The command automatically turns into the color mode.

Default: False

-r, --resize

Resize 200 percent.

Default: False

-t, --threshold
 

Threshold for monochrome, black and white images, default 50 percent. Colors above the threshold will be white and below will be black.

Default: 50%

-T, --trim

This option removes any edges that are exactly the same color as the corner pixels.

Default: False

-u, --unify

Unify the page size of all pages in a PDF File. The output must be a joined PDF.

Default: False

extract (ex, e)

Extract images from a PDF file and export them in the TIFF format.

pdf-compress.py extract [-h] input_file [input_file ...]
Positional Arguments
input_file A pdf file

join (jn, j)

Join the input files into a single PDF file. If the input file is not PDF file, it is converted into a monochrome CCITT Group 4 compressed PDF file.

pdf-compress.py join [-h] [-o] [-l OCR_LANGUAGE [OCR_LANGUAGE ...]]
                     input_files [input_files ...]
Positional Arguments
input_files
a.png a.png b.png c.png (asterisk).png “(asterisk).png” dir/ “dir/(asterisk).png”
Named Arguments
-o, --ocr

Perform optical character recognition (OCR) on the input files.

Default: False

-l, --ocr-language
 Run tesseract –list-langs to get your installed languages.

samples (sp, s)

Convert the samge image with different threshold values to find the best threshold value.

pdf-compress.py samples [-h] [-b] [-q] [-t] input_file
Positional Arguments
input_file A image or a PDF file. The script selects randomly one page of a multipaged PDF to build the series with differnt threshold values.
Named Arguments
-b, --blur

Convert images on different blur values.

Default: False

-q, --quality

Compress to JPEG2000 images in different quality steps.

Default: False

-t, --threshold
 

Convert images on different threshold values to monochrome black and white images.

Default: False

unify (un, u)

Unify the page size of all pages in a PDF File.

pdf-compress.py unify [-h] [-m MARGIN] input_file
Positional Arguments
input_file A PDF file
Named Arguments
-m, --margin Add a margin around each page in the PDF file.

image-into-pdf.py

Add or replace one page in a PDF file with an image file of the same page size.

usage: image-into-pdf.py [-h] [-c] [-v] [-V]
                         {add,ad,a,convert,cv,c,replace,re,r} ...

Positional Arguments

subcmd_args

Possible choices: add, ad, a, convert, cv, c, replace, re, r

Subcmd_args

Named Arguments

-c, --colorize

Colorize the terminal output.

Default: False

-v, --verbose

Make the cmd_args line output more verbose.

Default: False

-V, --version show program’s version number and exit

Sub-commands:

add (ad, a)

Add one image to an PDF file.

image-into-pdf.py add [-h] [-a AFTER | -b BEFORE | -f | -l] image pdf
Positional Arguments
image A image (or a PDF) file to add to the PDF page.
pdf The PDF file.
Named Arguments
-a, --after Place image after page X.
-b, --before Place image before page X.
-f, --first

Place the image to the first position.

Default: False

-l, --last

Place the image to the last position.

Default: False

convert (cv, c)

Convert a image file into a PDF file with the same dimensions.

image-into-pdf.py convert [-h] image pdf
Positional Arguments
image The image file to convert to the PDF format.
pdf The main PDF file (to get the dimensions).

replace (re, r)

Replace one page in a PDF file with an image (or an PDF) file.

image-into-pdf.py replace [-h] pdf number image
Positional Arguments
pdf The main PDF file
number The page number of the PDF page to replace.
image A image (or a PDF) file to replace the PDF page with.