Skip to content

About

Turn any photo into a knitting or crochet colourwork chart, then into a sized, step-by-step pattern. Free, private (runs in your browser), works offline.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Loop & Pixel logo

Loop & Pixel

Turn any photo into a knitting or crochet chart, then into a full, sized pattern.
Free · Private (runs entirely in your browser) · Works offline · Installable

Loop & Pixel home screen


Features

  • Photo → chart. Drop in any image to get a colourwork chart. You control the width in stitches, the number of colours (k-means in CIELAB colour space), background removal, crop and contrast, and stray-stitch clean-up.
  • Edit the chart. Paint squares by hand, rename yarns, merge colours, pick a stitch per colour, and toggle chart symbols.
  • Every colourwork method. Knit: intarsia, stranded/Fair Isle, duplicate stitch. Crochet: tapestry, intarsia, and corner-to-corner (C2C) with diagonal row reading.
  • 123 sized patterns. Beanies, jumpers, blankets, cushions, socks, mittens, amigurumi, doll clothes and more. Every pattern recalculates for your size, yarn weight and personal gauge, and places your chart inside the piece.
  • Row-by-row reader. Each row is spelled out as colour runs ("k12 Navy › k3 White › …"), with RS/WS direction and the current row highlighted on the chart.
  • Step-by-step mode. One instruction at a time, with a row counter and saved progress.
  • Learn. Illustrated tutorials for every technique the patterns use, linked from each step.
  • UK/AU and US crochet terms, switchable at any time.
  • My makes. Save charts and configured projects locally.

Pattern view   Mobile view

Privacy by design

Images are processed with the Canvas API on the user's device and are never uploaded. There is no backend, no accounts, no analytics and no cookies. Fonts are self-hosted, so the app makes no third-party requests. Saved work lives in localStorage. See privacy.html.

Getting started

Requires Node.js 18+.

npm install
npm run dev        # start the dev server at http://localhost:5173
Script What it does
npm run dev Vite dev server with hot reload
npm run build Production build to dist/ (includes service worker + manifest)
npm run preview Serve the production build locally
npm run lint ESLint over the source
npm run icons Regenerate PNG icons and the social image from public/logo.svg

Windows note: the npm scripts call Node directly (node node_modules/vite/bin/vite.js) instead of the usual vite shim. Windows runs npm shims through cmd.exe, which breaks on folder names containing & (such as Loop&Pixel). Calling Node directly works from any folder name.

Deployment

npm run build produces a fully static site in dist/. The build uses a relative base path, so it works from a domain root or a sub-folder. Deploy it to any static host:

  • Netlify / Cloudflare Pages / Vercel: build command npm run build, output directory dist.
  • GitHub Pages: publish the contents of dist/ (e.g. with the actions/deploy-pages workflow).

The app is a PWA. Once loaded, it works offline and can be installed to the home screen or desktop.

Project structure

├── index.html               App shell (header, nav, views, modals)
├── privacy.html             Privacy policy
├── terms.html               Terms & conditions
├── public/                  Static assets copied as-is
│   ├── logo.svg             Brand mark (source of all icons)
│   ├── favicon.svg
│   ├── og-image.png         Social share image
│   └── icons/               PWA / touch icons (generated)
├── src/
│   ├── main.js              Entry: styles, engine, UI, service worker
│   ├── legal.js             Entry for the legal pages
│   ├── engine/              Pattern engine (no DOM access)
│   │   ├── core.js          Yarns, sizes, crochet terms, shaping maths, chart placement, registry
│   │   ├── garments.js      Garments, accessories, home, baby, doll clothes
│   │   ├── amigurumi.js     Animals, dolls, flowers, plants, food
│   │   └── assembly.js      Builds a finished pattern (materials, gauge, text)
│   ├── learn/tutorials.js   Illustrated technique tutorials (inline SVG)
│   ├── app/                 User interface
│   │   ├── state.js         App state, persistence, DOM helpers
│   │   ├── color.js         Colour science (sRGB ↔ CIELAB, named colours)
│   │   ├── photo.js         Photo → chart (quantisation, background removal)
│   │   ├── chart.js         Row reading, C2C, chart canvas renderer, samples
│   │   ├── views.js         Routing and view rendering
│   │   ├── events.js        Event delegation and boot
│   │   └── icons.js         Inline SVG icon set
│   └── styles/              Design tokens, components, views, legal
├── scripts/generate-icons.mjs
├── docs/screenshots/
└── legacy/                  The original single-file version, kept for reference

Adding a pattern

Patterns register themselves with def({...}) from src/engine/core.js. Each definition declares its crafts, sizes, options and colours, plus a gen(ctx) function that writes sections and steps with the pattern builder (p.sec(), p.s()). The engine handles gauge maths, yarn estimates, crochet-term translation and chart placement. See the existing entries in garments.js and amigurumi.js for examples.

Before going live

The legal pages have a few highlighted placeholders to fill in for your deployment:

  • [contact email] in both privacy.html and terms.html
  • [hosting provider …] in privacy.html
  • [jurisdiction] in terms.html

These documents are a sensible starting point, not legal advice. Have them reviewed if you plan to operate the app commercially.

Tech

Vanilla JavaScript (ES modules) · Vite · vite-plugin-pwa · Fraunces & Inter via Fontsource · icon paths in the style of Lucide (ISC).

License

MIT

About

Turn any photo into a knitting or crochet colourwork chart, then into a sized, step-by-step pattern. Free, private (runs in your browser), works offline.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages