Skip to content

Python script to create halftone effects on images using DrawBot, with customizable options and batch processing support.

License

Notifications You must be signed in to change notification settings

werls/drawbot-halftone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drawbot Halftone

This is an evolution of my own basic halftone effect using Drawbot.

Drawbot is a macOS powerful tool for creating graphics and animations. It is a great tool for generative art and graphic design. This script uses Drawbot to create a halftone effect from an image.

Installation

  1. Clone this repository.
git clone https://github.com/werls/drawbot-halftone.git
  1. Change to the repository directory.
cd drawbot-halftone
  1. Install the requirements.
pip install -r requirements.txt
  1. Run the script.
python drawbot_halftone.py --path /path/to/image.jpg

Parameters

Parameter Type Description Default
--path string The path to the image file. None
--resolution int The resolution of the halftone grid. 100
--contrast float The maximum size of the halftone dots. 1
--dot-min-size float The minimum size of the halftone dots. 0
--angle float The angle of rotation for the halftone grid. 45
--color string The color of the halftone dots. 0,0,0,1
--color_mode string The color mode of the halftone dots (rgba or cmyk). rgba
--honeycomb bool Use a honeycomb grid instead of a square grid. True
--reescale_image bool Reescale the image to fit the canvas default size. False
--inverse bool Invert the colors of the image. False
--preset string A JSON string or file path of settings for the halftone effect. None
--verbose bool Print the settings of the halftone effect. True

Presets

You can create a JSON file with the settings for the halftone effect. Here is an example:

{
    "resolution": 100,
    "contrast": 1,
    "angle": 45,
    "color": "0,0,0,1",
    "color_mode": "rgba",
    "honeycomb": true,
    "reescale_image": false,
    "save": true
}

The preset file can be passed as a parameter to the script.

python drawbot_halftone.py --path /path/to/image.jpg --preset /path/to/preset.json

In the /presets/ folder you can find some examples of preset files.

Batch processing with presets

You can use the following command to process multiple images with the same preset.

for file in folder/*; do python main.py --path "$file" --preset=presets/halftone-pc-portraits.json; done

About

Python script to create halftone effects on images using DrawBot, with customizable options and batch processing support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages