Skip to content

KnitViz is a tool to interpret knitting patterns in JSON format and visualize them as stitch plots using Python. The project aims to bridge knitting and data visualization, providing knitters and designers with clear, customizable visual representations of patterns.

License

Notifications You must be signed in to change notification settings

HiDefTextiles/KnitViz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KnitViz

KnitViz is a Python-based visualization tool for interpreting knitting patterns from JSON format and presenting them as graphical stitch maps. This project is part of the HiDef Textiles initiative, a research project led by Dr. Helga Ingimundardóttir, Assistant Professor in Industrial Engineering at the University of Iceland. HiDef Textiles explores the intersections between textiles, data visualization, and computational design.

Features

  • Pattern Parsing: Reads and interprets knitting patterns in JSON format.
  • Stitch Visualization: Generates graphical representations of stitch sequences using SVG images for each stitch type.
  • Flexible Pattern Representation: Handles complex patterns, including increases, decreases, and special stitch types.

Getting Started

Prerequisites

  • Python (version 3.6 or higher)
  • Pillow and CairoSVG packages for image processing and SVG handling

Installation

  1. Clone this repository:
    git clone https://github.com/HiDefTextiles/KnitViz.git
    cd KnitViz
  2. Install required Python packages:
    pip install -r requirements.txt
  3. Preprocess SVG Files: Convert SVG files for each stitch type to PNG format using the preprocessing script:
    python preprocess_svg.py

Usage

  1. Add Your JSON Pattern File: Place your JSON knitting pattern file in the data/ directory ( e.g., devil_helmet.json).

  2. Run the visualization script: Generate the pattern visualization using the following command:

    python main.py --pattern data/devil_helmet.json

    This will produce PNG images for each pattern part and size, saved in the figures/ directory.

  3. View and Adjust Output: The resulting images can be opened and reviewed in any image viewer. Helper lines and custom styling adjustments are available within render_pattern_image in renderer.py.

Contributing

We welcome contributions! To propose enhancements or report issues, please use the Issues tab. Suggestions on supporting additional pattern formats or visualizations are especially appreciated.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

You are free to:

  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material

Under the following terms:

  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. Attribution should be made to the HiDef Textiles initiative led by Dr. Helga Ingimundardóttir at the University of Iceland.
  • NonCommercial — You may not use the material for commercial purposes.
  • ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

For further information, see the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

About

KnitViz is a tool to interpret knitting patterns in JSON format and visualize them as stitch plots using Python. The project aims to bridge knitting and data visualization, providing knitters and designers with clear, customizable visual representations of patterns.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages