GithubHelp home page GithubHelp logo

lizzthabet / speculative-camouflage Goto Github PK

View Code? Open in Web Editor NEW
16.0 0.0 1.0 5.52 MB

A pattern generator to create wearable, camouflage-inspired textile designs

Home Page: https://hide.lizz.website

JavaScript 5.47% HTML 4.75% TypeScript 86.28% CSS 3.49%
typescript p5js p5 perlin-noise kmeans-clustering fractals camouflage patterns textiles queer

speculative-camouflage's Introduction

Speculative camouflage generator

A pattern generator to create wearable textile designs

This tool can be used to create large patterns for wearables based on photographs of specific environments. It generates several designs that use multiscale and shape-disruptive camouflage techniques loosely based on a scientific paper published in 2013. Multiscale patterns employ details at various spatial scales to disguise the wearer, while disruptive patterns aim to distort and interrupt the wearer’s outline using blocks of shapes.

This tool’s patterns are rooted in the “real,” “historical,” and “scientific” but dismiss efficacy to speculate about how (and if?) camouflage can be used as a personal tool for bodied agency. It’s a part of a magical, material, and metaphorical costume that I’m building for myself, as a queer, femme body that lives and moves within a large city. I imagine camouflage as a conceptual and literal technology to hide, obscure, and misrecognize my body in public and corporate space.

A fractal noise pattern built with a photograph of a NYC subway train

The codebase

This project is primarily build with Typescript, HTML, and CSS with minimal external dependencies. All pattern generation is done on the client-side, meaning that no backend server is needed to process data or run the application.

It uses Webpack and Babel to compile and bundle source files and Gulp to manage development tasks and production builds. It uses Nginx to serve up the static website files and Tor to create and host over an onion site, (which can be accessed anonymously over the Tor network). Docker is used to create containerized versions of the Nginx server and Tor.

How it works!

A color palette is generated from an uploaded image and applied to multiple patterns, depending on the parameters in the create pattern form submission.

Color palette generation

  • Takes a list of RGB or HSL colors and converts them to LAB colors for more perceptually-accurate color grouping
  • Uses the deltaE2000 color difference formula to calculate the similarity between two LAB colors
  • Uses a k-means clustering algorithm to group color data into the most similar k groups

Fractal noise pattern

  • Generates a noise source pattern in HSL using Perlin noise with p5js and extracts a color palette from it
  • Maps the color palette from the source image to the noise source pattern by frequency
  • Generates the final noise pattern by substituting each color from the noise source with a color from the uploaded image's palette

Shape disruptive pattern

  • Generates a number of random voronoi cells using voronoi library
  • Randomly pairs colors from the source image's color palette to fill each voronoi cell with a gradient

Forms

  • Builds HTML edit forms for each pattern and attaches the appropriate listeners

Running the code

If you want to run the project locally, clone the repository and run a yarn install. I'd love to see others run, modify, and fork this tool. Feel free to reach out to me or open an issue in this repository if you run into any issues.

  • yarn dev: Runs the project with a development server
  • yarn build: Builds the project
  • yarn serve and yarn publish: Builds the project and hosts on an onion site

Related repos

For experiments with perlin noise that led to the development of this noise pattern, check out p5js-camo.

speculative-camouflage's People

Contributors

dependabot[bot] avatar derkalaender avatar lizzthabet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

4nuragb

speculative-camouflage's Issues

Can priorities be assigned to colors, the color palette re-ordered and/or colors replaced?

I've just started using this tool so I'm not familiar with how the image generation works, but would it be possible to have additional control over the color palette once a pattern has been generated, so that colors can be swapped within the palette to see how this changes the pattern? What I'm trying to do is see what effect swapping light and dark colors has to determine whether the colors look like they're receding or advancing.

Also, it would be really handy to have a control within the frontend to manually replace colors if I want to apply my own color schemes. This is not meant to make the color calculation routines redundant, just that if I want to quickly try out some different color schemes or replace a single color I would have to manually make a swatch image and upload it using the tool or bring the generated image into Photoshop and manually replace the colors.

Great software, by the way!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.