Plothatching
Crosshatching is a drawing technique for shading by stacking multiple layers of parallel lines. This page describes a workflow to transform a digital image to a crosshatched version, and penplot it. The general workflow consists of 3 steps:
- Select an image and convert it to crosshatches using a Processing sketch (find the code on GitHub).
- Use Inkscape to trace the output, and convert it to HPGL.
- Plot the HPGL file (for guides, see here).
The remainder of this page will give in depth guides to each of these steps.
Crosshatching code
Usage
EtherPatches is easy to use. It supports batch conversion: the program automatically converts everything in the input directory and saves the patched works to the output directory.
A step by step guide to EtherPatch your own pads is presented below. Setting up processing on your machine and obtaining the files (steps 1 and 2) need to be done only once.
- To crosshatch your own images, you'll need to be able to compile a Processing file. For this, there are several options:
- The easiest is downloading the Processing IDE
- You can also compile from the command line
- Your favorite IDE might offer plugins for Processing language and compilation support, like this one for vscode
- Next, you need to obtain the code. Again, there are several options:
- Go to https://github.com/Nyxaeroz/Crosshatching, press the button that says code, download the zip and unzip it wherever you want this project to reside on your machine.
- Moving to your desired location and use the following command in a terminal to clone the repository:
git clone https://github.com/Nyxaeroz/Crosshatching.git
- Follow the steps presented in README.md:
- Choose an image to crosshatch and save it into the same folder as hatcher.pde.
- Consider the image dimensions. As the crosshatched version usually won't require a high fidelity image, a high resolution will just increase runtime. Consider changing the dimensions to fit within 1000x1000px.
- Open
sketch.pde
- Change the variable
input_name
(line 4) to match your input file's name. - Change the variables
input_width
(line 11) andinput_height
(line 12) to the dimensions of your file. - Change
size(W,H)
(line 18) such that W and H are the width resp. height of your file. - Run the program.
- The output will be shown, and the seperate svg layers will, by default, be saved to a folder output_layers.
Parameters
Several parameters may be altered to achieve different results. In particular:
int nr_layers
(line 6): the number of crosshatch-layers to be used.int v_line_offset
(line 8): the space between two lines within one crosshatch-layerfloat blur-radius
(line 9): because, often, we don't want the smallest details to appear in our crosshatch, we apply a Gaussian blur. This radius determines it's size. A size of 0 can be used to not use a blur.boolean save
(line 14): the program will save the layers if and only if 'save' is set to true. Not saving would still display the image, and is useful e.g. in tweaking the parameters.
Notes
Though the layers are saved as svg, in actuality these svgs contain images... At the moment, it is advised to use other programs to convert this to actual vector layers.