Package: imgtk
imgtkImage file manipulation toolkitThis tool provides image file manipulation subcommands.  Currently
supported commands are as follows:sub commandDescriptionjoinJoin multiple image files into one PDF file.sortSort image files into folders using exif datededupFind duplicate images in folder using image hashInstallation> pip install imgtkUsage : joinConvert set of images to PDF.This tool is intended to merge multiple scanned images into one PDF file.
The tool will take multiple images in order, a directory of images or
both and merge them into a PDF file in the order it is given.
Images in the directory will be searched by specified extensions and sorted by name.Usage: imgtk join [OPTIONS] [IMG]...Join images into one PDF fileOptions:-c, --config <cfg>  Configuration File (default: imgtk-join.yml)-o, --out <out>     output filename for the generated PDF-t, --toc <toc>     toc file to populate PDF outline-e, --ext <ext>     file extensions to pick up when parsing directories-d, --dpi <dpi>     pixel density of input image in dpi-v, --verbose       output in verbose mode-h, --help          Show this message and exit.Options-c, --configConfiguration File (default: i2p.yml)-o, --outoutput filename for the generated PDF-t, --toctoc file to populate PDF outline (TBD)-e, --extfile extensions to pick up when parsing directories.
directories will be searched for all files using this extensions.can set multiple items.-d, --dpipixel density of input image in dpi.  used to calculate image width and
height in mm.-v, --verboseoutput in verbose modespecify twice to get debug messages-h, --helpShow help messageConfiguration fileYAML based configuration file (default file name: imgtk-join.yaml)
is used to store default settings for the tool.
The command line options will take precedence over the configuration parameters.Following shows the default settings of the configurationout:output.pdftoc:toc.ymldpi:96ext:-jpg-jpeg-pngTOC File (default name: toc.yml)Consist of dictionary with following structure, wherelevelis the
outline level (starting from 0), andtitleis the title of the
outline and will be inserted atpagenum.  The keys are case
sensitive.pagenum:-level:Numtitle:'Title'Note, each entry inside the page must be an array of dictionaries.
This is to allow multiple ToC item to be inserted in one page.Example may be as follows:1:-level:0title:'GettingStarted'-level:1title:'Installation'3:-level:1title:'Hello,World'5:-level:0title:'ProgrammingaGuessingGame'Usage : sortCommand to sort image files in one folder to another by date of image (exif meta-data or file creation date).Moves/Copies the images inside SRCDIR into sorted folders under TGTDIR.
Target folders will be sorted based on the date the image was created
(Referes to Exif meta-data or the file creation date if exif is not
available).Usage: imgtk sort [OPTIONS] SRCDIR TGTDIRSort and Move/Copy images from SRCDIR to TGTDIR.Options:--copy           Copy files from SRCDIR to TGTDIR (Default)--move           Move files from SRCDIR to TGTDIR-r, --recurse    Search for images in SRCDIR recursively-o, --overwrite  Overwrite files in TGTDIR-H, --hierarch   Create a hierarchical directory for Year, Month and Date inTGTDIR-d, --dry-run    Dry run the command without moving-f, --fmt <fmt>  Format target directory name using date format strftimestring give in <fmt> (default: %Y-%m-%d).-v, --verbose    output in verbose mode-h, --help       Show this message and exit.Options--copy/--movespecify whether the file should be copied or moved.
Files will be copied if not specified.-r, --recursivesearch images in SOURCEDIR and any subdirectories.-o, --overwriteoverwrite any image files in TARGETDIR-H, --hierarchcreate a folder for year, month and date in a hierarchical manner
instead of one folder for each date.-d, --dry-rundry run the command.  nothing will be moved-f, --fmt DATEFORMATformat the folder name using date format string specified by DATEFORMATignored when "-h" is specified.-v, --verboseverbose modeUsage : dedupThis is a tool to find similar images in a set of images using imagehash
library.  If two or more similar images are found (same hash value), the
images are moved to a subfolder for each hash value.Usage: imgtk dedup [OPTIONS] PATHFind duplicates in PATH using <hashfunc><hashfunc> can be any of the following:ahash   : Average hashphash   : Perceptual hashdhash   : Difference hash (default)haar    : Haar wavelet hashdb4     : Daubechies wavelet hashcolor   : HSV color hashcrop    : crop-resistant hashOptions:-s, --hash-size <size>      hash size to use for image hashing (default:dhash)-f, --hash-func <hashfunc>  hash function to use for comparing images-v, --verbose               output in verbose mode-h, --help                  Show this message and exit.OptionsPATHPATH with the images to check for (will not be recursed)-s, --hash-size SIZEspecify the hash size to use. (Default: 8)-f, --hash-funcahashUse Average hash to find duplicates in PATHcolorUse HSV color hash to find duplicates in PATHcropUse Crop resistant hash to find similar images in PATHdb4Use Daubechies wavelet hash to find duplicates in PATHdhashUse Difference hash to find duplicates in PATHhaarUse Haar wavelet hash to find duplicates in PATHphashUse Perceptual hash to find duplicates in PATH-v, --verbosespecify verbosity.  specify twice to get debug messageIf two or more images with the same hash is found, they are put into the
same folder with tha hash value as the folder name.Known IssuesNeed to be implemented.DevelopmentBuilding an ExecutableInstall pyinstaller and package the project.
May want to use venv when executing the pyinstaller.First, enter venv and install the local package and pyinstaller>. .venv/Scripts/activate(.venv)>pip install .Processing /path/to/proj/imgtk~snip~Installing collected packages: imgtkRunning setup.py install for imgtk ... doneSuccessfully installed imgtk-0.1.0(.venv)>pip install pyinstaller~snip~Successfully installed pyinstaller-3.6Use pyinstaller to build the exe file.(.venv)>pyinstaller imgtk\cli.py --onefile --name imgtk~snip~13691 INFO: Building EXE from EXE-00.toc completed successfully.Executable should be ready in dist/imgtk.exeVersioningThe project will follow thesemver2.0versioning scheme.With initial development phase starting at 0.1.0 and increasing
minor/patch versions until we deploy the tool to production
(and reach 1.0.0).
The interface relevant to versioning is whatever defined in this
document's "Usage" section (includes all (sub)commands, their cli arguments,
and the format of the configuration file "imgtk.yaml").Version HistoryDateVersionChanges2023.11.121.0.0Bump to 1.0.0.  Update Pillow to latest2023.01.260.1.0First Release