Binaryscarf generates double-knitting patterns for some corpus of input text.

binaryscarf

binaryscarf generates double-knit patterns for some corpus of input text. The layout follows the same style as described here. Output is saved as a PNG image.

The characters are encoded as 7-bit binary (ASCII), where each binary digit represents the foreground or background color. The scarf will use a configurable number of columns.

The length of the pattern will be dependent on the number of selected columns, plus the length of the input text. The width depends on the number of columns and the configurable spacing between colums.

The words in the input text are layed out top-to-bottom, left-to-right. For instance, the phrase "Machines take me by surprise with great frequency.", with 2 colums will be drawn as follows:

===            ===============
M i            1001101 1101001
a s            1100001 1110011
c e            1100011 1100101
h              1101000
i w            1101001 1110111
n i            1101110 1101001
e t            1100101 1110100
s h            1110011 1101000
              
t g            1110100 1100111
a r            1100001 1110010
k e            1101011 1100101
e a     =>     1100101 1100001
  t                    1110100
m              1101101
e f            1100101 1100110
  r                    1110010
b e            1100010 1100101
y q            1111001 1110001
  u                    1110101
s e            1110011 1100101
u n            1110101 1101110
r c            1110010 1100011
p y            1110000 1111001
r .            1110010 0101110
===            ===============

The pattern does not assume any specific cast-on, bind-off or bordering. This will be up to the knitter to choose. However, for best results, I recommend the following:

Install

$ go get github.com/hexaflex/binaryscarf

Usage

usage: binaryscarf [options] <textfile>
   or: cat <textfile> | binaryscarf [options]

  -border int
    	Optional decorative n-row border at top and bottom of work: [0..n] (default 2)
  -color-a string
    	Foreground color in 24-bit hexadecimal notation. (default "0xffffff")
  -color-b string
    	Background color in 24-bit hexadecimal notation. (default "0x647384")
  -columns int
    	Number of 7-bit columns to generate: [1..n] (default 3)
  -out string
    	Filename for resulting PNG image. (default "out.png")
  -repeat int
    	Number of times to repeat the input text: [1..n] (default 1)
  -spacing int
    	Number of stitches to leave blank between columns: [0..n] (default 2)
  -stitch-height int
    	Height of a single stitch, in pixels: [1..n] (default 3)
  -stitch-width int
    	Width of a single stitch, in pixels: [1..n] (default 2)
  -version
    	Display version information.

Refer to testdata/Makefile for some invocation examples. And the images in testdata/ for output samples.

The stitch-width and stitch-height values are provided, so the resulting pattern may reflect the way real knit stitches are shaped. They are never perfectly square. Desiging a pattern with square stitches, will end up looking squashed in either width or height, when knitted. Adjusting the pattern to account for this property, will ensure the desired result is achieved. A stitch-width of 2 and stitch-height of 3 usually gives a reasonable approximation of the real thing.

license

Unless otherwise noted, the contents of this project are subject to a 1-clause BSD license. Its contents can be found in the enclosed LICENSE file.

Similar Resources

I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute.

I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute.

Go-language I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute. This repo is for pr

Jan 21, 2022

This is a brief tutorial I created for a couple friends to show how to do some stuff in go and ethereum. Feel free to do any PRs with suggestions

golang-tutorial This is a brief tutorial I created for a couple friends to show how to do some stuff in Go and Ethereum. Milestones Create the environ

Aug 29, 2022

About An instrumented microservice in Go - it'll give you some Honeycomb data to play with.

Intro to Observability: OpenTelemetry in Go This application is here for you to try out tracing. It consists of a microservice that calls itself, so y

Dec 5, 2022

The repository intent is store some Go Lang codes.

⚠️ Go programming course ⚠️ This repository was created to share the Learn How To Code: Google's Go (golang) Programming Language code created by Todd

Jan 16, 2022

Mastering-go-exercises - Some code examples from Mihalis Tsoukalos book titled Mastering GO

Mastering go exercises This is a training repository. Here are some code example

Feb 16, 2022

The go language version developed based on hashlips_art_engine. Added and deleted some functions

The go language version developed based on hashlips_art_engine. Added and deleted some functions

golips_art_engine The inspiration for this tool is based on HashLips Art Engine. Our official links 🐦 Twitter 💄 Discord 💄 NFT Why building a new to

Jul 28, 2022

Generates random text based on trigrams generated from input text

Generates random text based on trigrams generated from input text

Trigrams Generates random text based on trigrams generated from input text Contents Building Running Using Implementation notes NGram size Maximum wor

Feb 9, 2022

A corpus of popular Go modules

corpus A corpus of popular Go modules. See top-100.tsv for the latest sample. This corpus is to be used when analyzing or studying Go code.

Jan 6, 2023

Project-1 - Create a service that accepts input as text and provides Json Output as Top ten most used words and times of occurrence in the text

Project Assignment Steps to run the project: download or clone repo in your loca

Jan 27, 2022

LogAnalyzer - Analyze logs with custom regex patterns.Can search for particular patterns on multiple files in a directory.

LogAnalyzer - Analyze logs with custom regex patterns.Can search for particular patterns on multiple files in a directory.

LogAnalyzer Analyze logs with custom regex patterns.Can search for particular patterns on multiple files in a directory

May 31, 2022

Go-concurrency-patterns - Sample concurrency patterns with Goroutines

About This sample project provides some concurrency pattern examples in Go using

Feb 21, 2022

Read from standard input and output a Haags translation of the given input.

haags Read from standard input and output a Haags translation of the given input. Building make && sudo make install You may also run go build on syst

Oct 23, 2022

A ocilloscope writen in GO. Supported serial input, portaudio input.

A ocilloscope writen in GO. Supported serial input, portaudio input.

Oct 23, 2021

Advent of Code Input Loader, provide a session cookie and a problem date, returns a string or []byte of the input

Advent of Code Get (aocget) A small lib to download your puzzle input for a given day. Uses your session token to authenticate to obtain your personal

Dec 9, 2021

Benthos-input-grpc - gRPC custom benthos input

gRPC custom benthos input Create a custom benthos input that receives messages f

Sep 26, 2022

Takes an input http.FileSystem (likely at go generate time) and generates Go code that statically implements it.

vfsgen Package vfsgen takes an http.FileSystem (likely at go generate time) and generates Go code that statically implements the provided http.FileSys

Dec 18, 2022

Takes an input http.FileSystem (likely at go generate time) and generates Go code that statically implements it.

vfsgen Package vfsgen takes an http.FileSystem (likely at go generate time) and generates Go code that statically implements the provided http.FileSys

Dec 18, 2022

dfg - Generates dockerfiles based on various input channels.

dfg - Dockerfile Generator dfg is both a go library and an executable that produces valid Dockerfiles using various input channels. Table of Contents

Dec 23, 2022

A highly optimized double-ended queue

Overview Deque is a highly optimized double-ended queue. Benchmark Benchmark_PushBack/Dequeharden 100000000 10.3 ns/op 9 B/op

Dec 13, 2022
A go implemention of efficiently-updatable double-array trie

cedar Package cedar implementes double-array trie, base on cedar-go. It is a Golang port of cedar which is written in C++ by Naoki Yoshinaga. cedar-go

Sep 16, 2022
23 design patterns of GoF

GoF 设计模式 GoF所提出的23种设计模式主要基于以下面向对象设计原则: 对接口编程而不是对实现编程 优先使用对象组合而不是继承 23种设计模式分为三大类:创建型模式(Creational Patterns)、结构型模式(Structural Patterns)、行为型模式(Behavioral

Nov 29, 2022
Concurrency patterns in Go

Concurrency patterns in Go

Dec 28, 2022
Go-design-pattern-examples - Golang implementations of common design patterns

Design Patterns Golang implementations of common design patterns Build project T

Oct 29, 2022
Go Design Patterns
Go Design Patterns

Creational patterns provide out-of-the-box objects for users instead relying on the user to know how to build the object which in some cases could be complex.

Feb 8, 2022
Patternfinder - Find patterns in http output based on regex string. Display occurences

Patternfinder Find patterns in HTTP output based on regex string. Display occurr

Feb 18, 2022
Practical concurrency guide in Go, communication by channels, patterns

Go Concurrency Guide This guide is built on top of the some examples of the book Go Concurrency in Go and Go Programming Language Race Condition and D

Dec 28, 2022
Repo Tugas Basic Programming Part 2(Input/Output, Branching, Looping) ALTA Immersive BE5

Cara mengerjakan tugas hari ke 2 clone project ini dengan cara git clone https://github.com/jackthepanda96/Intro-to-Algoritm-Part2.git setelah clone

Dec 15, 2021
Tugas Alta Immersive Backend Golang Basic Programming Part 2(Input/Output, Branching, Looping)
Tugas Alta Immersive Backend Golang Basic Programming Part 2(Input/Output, Branching, Looping)

Tatacara Melakukan Setup Tugas clone project ini dengan cara git clone https://github.com/Immersive-Backend-Resource/Basic-Programming-Part2.git sete

Jan 9, 2022
Some examples for the programming language Go.

Golang_Examples Bubblesort: simple implementation of bubble sort algorithm in Go Level: Beginner GenericStack: a stack (LIFO collection) that can hold

Jul 28, 2022