Coder Social home page Coder Social logo

spiky-clouds's Introduction

Spiky Clouds

This is a filter that converts images into spiky images. The image is created by drawing needles instead of pixels for each pixel value.

You get a crappy drawing of yours and it transforms the drawing into a spooky image:

Original Spiky
logo spiky logo
lena spiky logo

Installation

npm install spiky-clouds

Dependencies

Usage

const sc = require("spiky-clouds")
sc(inputFile, outputFile, {seed: 42}).then(() => {
  console.log("done!");
});

sc(inputFile, outputFile[, opts]):

Applies the filter in the inputFile generating the outputFile.

opts:

  • seed: Chooses the seed to be used for pseudo random number generation.
  • minLength: Chooses the minimum length of a needle. Default: 0.00 (0%).
  • maxLength: Chooses the maximum length of a needle. Default: 0.02 (2%).
  • minWidth: Chooses the minimum width of a needle. Default: 0.0005 (0.05%).
  • maxWidth: Chooses the maximum width of a needle. Default: 0.001 (0.1%).
  • alpha: Sets the value for the alpha channel for the needles. Default: 255
  • rotation: Chooses the mode in which the needles align. Default: "min_gradient". Available modes:
    • min_gradient: Draws the needles in the direction of the smallest gradient.
    • max_gradient: Draws the needles in the direction of the largest gradient.
    • random: Draws the needles randomly.
  • angles: Limits the available angles (in degrees) for the rotation modes, eg: [0, 180] - horizontal needles.
  • verbose: Shows the progress of the render.

The value arguments maxLength, minLength, maxWidth, minWidth should be a float that represents a percentage of the perimeter, eg: 0.05 => 5% of the perimeter.

Command line

There's also a command line application

Usage: spiky-clouds [-h | -v] [OPTS] INPUT_FILE OUTPUT_FILE
Converts images applying the 'spiky-clouds' filter

Arguments:
  -h, --help        Show this help.
  -v, --version     Shows the software version.
  -s, --seed        Chooses the seed to be used for pseudo random number generation.
  -l, --min-length  Chooses the minimum length of a needle. Default: 0.00 (0%).
  -L, --max-length  Chooses the maximum length of a needle. Default: 0.02 (2%).
  -w, --min-width   Chooses the minimum width of a needle. Default: 0.0005 (0.05%).
  -W, --max-width   Chooses the maximum width of a needle. Default: 0.001 (0.1%).
  -a, --alpha       Sets the value for the alpha channel for the needles. Default: 255
  -r, --rotation    Chooses the mode in which the needles align. Default: "min_gradient".
    Available modes:
      min_gradient  Draws the needles in the direction of the smallest gradient.
      max_gradient  Draws the needles in the direction of the largest gradient.
      random        Draws the needles randomly.
  -g, --angles:     Limits the available angles (in radians) for the rotation modes, eg: "[0, PI]" - horizontal needles.
  --verbose:        Shows the progress of the render

Examples

Mode Logo Lena
Original logo lena
Minimum gradient rotation logo lena
Maximum gradient rotation logo lena
Random rotation logo lena
Medium alpha logo lena
Low alpha logo lena
Big needle length logo lena
Small needle length logo lena
Medium needle width logo lena
Big needle width logo lena
Angles: 45°, 135°, -45° -135° logo lena

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

spiky-clouds's People

Contributors

dependabot[bot] avatar luxedo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.