Skip to content

lindsaylandry/go-cross-stitch

Repository files navigation

Go Cross-Stitch Pattern Generator

This is a project that will take an image and convert it to a png and pdf of DMC thread colors and instructions.

Other palettes include Anchor cross-stitch threads, simple LEGO colors, and greyscale.

How To Use

Build From Scratch

To build the binary, run the following:

make build

General Usage

Once the binary is compiled, use as follows:

./bin/cross-stitch -n 10 examples/test_images/FullMoon150px.jpg

This will make two files in examples/test_images:

FullMoon150px-dmc-lab.png
FullMoon150px-dmc.pdf

the png is the image converted to cross-stitch DMC thread colors. the PDF is the instructions to stitch the pattern, with the DMC image included.

Flags

./bin/cross-stitch --help
Usage of ./bin/cross-stitch:
  -all
    	use all thread colors available (currently broken)
  -color string
    	color palette to use (OPTIONS: dmc, lego, bw) (default "dmc")
  -d	implement dithering
  -g	convert image to greyscale
  -n int
    	number of colors to attempt to match (2^n) (default 6)
  -rgb
    	use rgb color space

Render all test images

make examples

References

Color distance formulas: https://en.wikipedia.org/wiki/Color_difference

Color quantization: https://en.wikipedia.org/wiki/Color_quantization

CIELab color space: https://en.wikipedia.org/wiki/CIELAB_color_space

Example Image Conversions

Mars (reds)

Original RGB Distance CIELab Distance

Earth (blues and greens)

Original RGB Distance CIELab Distance

Moon (greyscale)

Original RGB Distance CIELab Distance

Full Color Spectrum

Original RGB Distance CIELab Distance

About

GoLang Package for creating cross-stitch patterns from images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published