Plothatching

From XPUB & Lens-Based wiki
Revision as of 16:40, 14 January 2024 by Thijshijsijsjss (talk | contribs) (Re-add github link to intro)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Example input
Example output

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.

Find the code on GitHub.

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.

  1. To crosshatch your own images, you'll need to be able to compile a Processing file. For this, there are several options:
  2. Next, you need to obtain the code. Again, there are several options:
  3. Follow the steps presented in README.md:
    1. Choose an image to crosshatch and save it into the same folder as hatcher.pde.
    2. 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.
    3. Open sketch.pde
    4. Change the variable input_name (line 4) to match your input file's name.
    5. Change the variables input_width (line 11) and input_height (line 12) to the dimensions of your file.
    6. Change size(W,H) (line 18) such that W and H are the width resp. height of your file.
    7. Run the program.
    8. 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-layer
  • float 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.

Plotting

This software was created when working with penplotters. The general workflow of penplotting a crosshatched image consists of 3 steps:

  1. Select an image and convert it to crosshatches using a Processing sketch (find the code on GitHub).
  2. Use Inkscape to trace the output, and convert it to HPGL.
  3. Plot the HPGL file (for guides, see here).

A full workflow can be found on this dedicated project page.