Skip to content
Convert images to plotter-friendly hatched patterns
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Convert images to plotter-friendly hatched patterns.

Built with OpenCV, scikit-image, Shapely, matplotlib and svgwrite.

Getting Started


To play with hatched, you need to checkout the source and install the dependencies in a virtual environment, for example with the following steps:

$ git clone
$ cd hatched
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Running the example

Example can then be run by executing the corresponding file:

$ cd examples
$ python

The processing result is displayed in a matplotlib window:


A skull.svg file is also created with the output graphics.


Call the function hatched.hatch() to process your image. It takes the following parameters:

  • file_path: input image (most common format are accepted)
  • image_scale: scale factor to apply to the image before processing
  • interpolation: interpolation to apply for scaling (typically either cv2.INTER_LINEAR or cv2.INTER_NEAREST)
  • blur_radius: blurring radius to apply on the input image (0 to disable)
  • hatch_pitch: hatching pitch in pixel (corresponds to the densest possible hatching)
  • levels: tuple of the 3 thresholds between black, dark, light and white (0-255)
  • h_mirror: apply horizontal mirror on the image if True
  • invert: invert pixel value of the input image before processing (in this case, the level thresholds are inverted as well)
  • circular: use circular hatching instead of diagonal
  • show_plot: (default True) display contours and final results with matplotlib
  • save_svg: (default True) controls whether or not an output SVG file is created


This project is licensed under the MIT License - see the LICENSE file for details.

The example image skull.jpg is licenced under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Creative Commons License

You can’t perform that action at this time.