Package: halftone-converter
Halftone ConverterAn image converter to create high quality halftone imagesKey FeaturesEasily halftone your imagesHigh-quality rendering using Cairo graphics libraryHalftones of 3 color types – Gray, RGB, and CMYKColor space transformation using ICC profilesInstallpip3installhalftone-converterRequirementsThis application can be run from Python3 on any OS.
Note thatPycairo requires Cairo core library.Python >= 3.9NumPy >= 1.24Pillow >= 9.3Pycairo >= 1.23Rich >= 13.0UsageThis application takes image files as input and outputs halftones as image files.Quickstarthalftonecvinput.pngThe main program can be invoked either through thehalftonecvcommand or through the Python main module optionpython3 -m halftonecv.
It has command line interface as shown below.usage: halftonecv [-h] [-v] [-q] [-e] [-g] [-f] [-O | -d DIR] [-P PREFIX] [-S SUFFIX]
                  [-E [START]] [-p PX] [-x SCALE] [-b [{box,gaussian}]]
                  [-B PX] [-F {nearest,linear,lanczos2,lanczos3,spline36}]
                  [-A DEG] [-t DEG DEG DEG] [-a DEG DEG DEG DEG]
                  [-m {auto,gray,rgb,cmyk}] [-o {auto,gray,rgb,cmyk}] [-T]
                  [-G GRAY_ICC_FILE] [-I RGB_ICC_FILE] [-M CMYK_ICC_FILE]
                  [-L GRAY_ICC_FILE] [-l {per,sat,rel,abs,0,1,2,3}]
                  [-R RGB_ICC_FILE] [-r {per,sat,rel,abs,0,1,2,3}]
                  [-C CMYK_ICC_FILE] [-c {per,sat,rel,abs,0,1,2,3}] [-H]
                  [--ignore] [--discard] [--naive] [--gamma-correction]
                  [--key RATE] [-K] [--keep-red] [--keep-green] [--keep-blue]
                  [--keep-cyan] [--keep-magenta] [--keep-yellow] [--keep-key]
                  FILE [FILE ...]Positional ArgumentsFILEdescribe input image files (required), can be multiplePass-to specify standard input as input.Input images' formats are limited to what Pillow can read.
Also, their color spaces must be Gray (L, grayscale), LA (grayscale with alpha), RGB, RGBA, P (GIF, transparent images), or CMYK.Optional Arguments-h, --helpshow the help message and exit-v, --versionshow program's version number and exit-q, --quietsuppress non-error messages-e, --exitstop the program immediately by an error even if jobs remainBy default, it skips failed jobs and starts the next one.-g, --globinterpretFILEvalues as glob patterns (e.g.,*.png,**/*.jpg)Use this option if the shell's wildcard expansion is not available and enough.
Pattern**matches any files and zero or more directories recursively.
This glob function will NOT include hidden files or directories.-f, --forceoverwrite existing files by outputsBy default, an alternate filename will be used if the original filename conflicts.-O, --stdoutsend output to standard outputOnly one image can be input when using this option.-d DIR, --directory DIRsave output images inDIRdirectoryThe directory will be created automatically if it does not exist.-P PREFIX, --prefix PREFIXspecify a prefix string of output filenames-S SUFFIX, --suffix SUFFIXspecify a suffix string of output filenames-E [START], --enumerate [START]use consecutive numbers as output filenamesIt counts up by one fromSTART.
The defaultSTARTis 1.-p PX, --pitch PX, --interval PXarrange halftone dots at intervals ofPXpixels in input imagesChange this value for desired results.
The default value is 4.0.-x SCALE, -s SCALE, --scale SCALEthe scale factor of output images to input imagesThe default value is 1.0.-b [{box,gaussian}], --blur [{box,gaussian}]apply blur effectIf no blur type is specified, gaussian is used.-B PX, --blur-radius PXspecify blur radiusIf not specified, half of the pitch is used.-F {nearest,linear,lanczos2,lanczos3,spline36}, --resample {nearest,linear,lanczos2,lanczos3,spline36}resampling method for determining dot sizeThe default islinear.-A DEG, --angle DEG, --gray-angle DEGarrange dots byDEGdegrees in Gray channel-t DEG DEG DEG, --Angles DEG DEG DEG, --rgb-angles DEG DEG DEGarrange dots byDEGdegrees in each RGB channels respectively-a DEG DEG DEG DEG, --angles DEG DEG DEG DEG, --cmyk-angles DEG DEG DEG DEGarrange dots byDEGdegrees in each CMYK channels respectively-m {auto,gray,rgb,cmyk}, --mode {auto,gray,rgb,cmyk}color space type to generate halftonesThe default isauto.
It means that Gray images will be Gray halftones, and colored images will be CMYK halftones.-o {auto,gray,rgb,cmyk}, --output {auto,gray,rgb,cmyk}color space type to save output imagesThe default isauto.
It means that Gray images will be saved as Gray images, and colored images will be saved as RGB images.-T, --tiff, --out-tiffsave TIFF images instead of PNG imagesCMYK images will always be saved in TIFF regardless of this option.-G GRAY_ICC_FILE, --input-gray-profile GRAY_ICC_FILEspecify ICC profile for input Gray images-I RGB_ICC_FILE, --input-rgb-profile RGB_ICC_FILEspecify ICC profile for input RGB images-M CMYK_ICC_FILE, --input-cmyk-profile CMYK_ICC_FILEspecify ICC profile for input CMYK images-L GRAY_ICC_FILE, --gray-profile GRAY_ICC_FILEspecify ICC profile for transform to Gray images-l {per,sat,rel,abs,0,1,2,3}, --gray-intent {per,sat,rel,abs,0,1,2,3}rendering intent for transform to Gray images-R RGB_ICC_FILE, --rgb-profile RGB_ICC_FILEspecify ICC profile for transform to RGB images-r {per,sat,rel,abs,0,1,2,3}, --rgb-intent {per,sat,rel,abs,0,1,2,3}rendering intent for transform to RGB images-C CMYK_ICC_FILE, --cmyk-profile CMYK_ICC_FILEspecify ICC profile for transform to CMYK images-c {per,sat,rel,abs,0,1,2,3}, --cmyk-intent {per,sat,rel,abs,0,1,2,3}rendering intent for transform to CMYK images-H, --allow-hugedisable the limitation of input image sizeBe careful in the context of server-side applications.
This option may make DoS attacks possible (Decompression bomb).--ignore, --ignore-embedded-profiledon't respect ICC profiles embedded in input images--discard, --discard-profiledon't embed ICC profiles in output images--naive, --naive-transformuse approximate color space conversion algorithm (naive transform) instead of ICC profile-based transform--gamma-correctionapply sRGB gamma correction for RGB-CMYK conversion when the naive transform is used--key RATE, --key-from RATEblack ingredient threshold within 0.0-1.0 for RGB-CMYK conversion when the naive transform is used-K, --keep-alldon't convert any channels to halftonesThis is useful for previewing color space transform.--keep-reddon't convert R channels to halftones--keep-greendon't convert G channels to halftones--keep-bluedon't convert B channels to halftones--keep-cyandon't convert C channels to halftones--keep-magentadon't convert M channels to halftones--keep-yellowdon't convert Y channels to halftones--keep-keydon't convert K channels to halftonesGalleryRGBCMYKCMYK (Japan Color 2011 Coated)Example with user's custom ICC profileGrayAcknowledgmentsThis application contains some default ICC profiles to convert images between different color spaces.sGray.icc,sRGB.iccandSWOP.iccare provided by Artifex Software as a part ofGPL Ghostscriptunder theGNU Affero General Public License v3.0.LicenseGNU Affero General Public License v3.0