How to use vpype - 3 common examples

To help you get started, we’ve selected a few vpype examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github abey79 / hatched / hatched / vpype_plugin.py View on Github external
    type=Length(),
    help="Hatching pitch for the densest zones. This option understands supported units.",
)
@click.option(
    "-x",
    "--invert",
    is_flag=True,
    help="Invert the image (and levels) before applying thresholds.",
)
@click.option(
    "-c", "--circular", is_flag=True, help="Use circular instead of diagonal hatches."
)
@click.option(
    "-d",
    "--show-plot",
    is_flag=True,
    help="Display the contours and resulting pattern using matplotlib.",
github abey79 / hatched / hatched / vpype_plugin.py View on Github external
):
    """
    Generate hatched pattern from an image.

    The hatches generated are in the coordinate of the input image. For example, a 100x100px
    image with generate hatches whose bounding box coordinates are (0, 0, 100, 100). The
    `--scale` option, by resampling the input image, indirectly affects the generated bounding
    box. The `--pitch` parameter sets the densest hatching frequency,
    """
    logging.info(f"generating hatches from {filename}")

    interp = cv2.INTER_LINEAR
    if interpolation == "nearest":
        interp = cv2.INTER_NEAREST

    return LineCollection(
        hatched.hatch(
            file_path=filename,
            levels=levels,
            image_scale=scale,
            interpolation=interp,
            blur_radius=blur,
            hatch_pitch=pitch,
            invert=invert,
            circular=circular,
            show_plot=show_plot,
            h_mirror=False,  # this is best handled by vpype
            save_svg=False,  # this is best handled by vpype
        )
github abey79 / hatched / hatched / vpype_plugin.py View on Github external
@generator
def hatched_gen(
    filename: str,
    levels,
    scale: float,
    interpolation: str,
    blur: int,
    pitch: int,
    invert: bool,
    circular: bool,
    show_plot: bool,
):
    """
    Generate hatched pattern from an image.

    The hatches generated are in the coordinate of the input image. For example, a 100x100px
    image with generate hatches whose bounding box coordinates are (0, 0, 100, 100). The

vpype

The Swiss Army knife of vector graphics for pen plotters

MIT
Latest version published 10 months ago

Package Health Score

69 / 100
Full package analysis