https://github.com/luxedo/spiky-clouds
A filter to convert images into spiky images
https://github.com/luxedo/spiky-clouds
drawing filter needle p5js
Last synced: 2 months ago
JSON representation
A filter to convert images into spiky images
- Host: GitHub
- URL: https://github.com/luxedo/spiky-clouds
- Owner: luxedo
- License: gpl-3.0
- Created: 2019-01-15T13:45:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-10T00:18:08.000Z (about 3 years ago)
- Last Synced: 2025-01-30T23:47:38.236Z (3 months ago)
- Topics: drawing, filter, needle, p5js
- Language: JavaScript
- Homepage:
- Size: 7.79 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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|
|:-------------------------:|:-------------------------:|
|||
|||## Installation
```bash
npm install spiky-clouds
```
### Dependencies
- [Processing](https://processing.org/)
- [XVFB](https://www.x.org/archive/X11R7.7/doc/man/man1/Xvfb.1.xhtml)## Usage
```javascript
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' filterArguments:
-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|||
|Minimum gradient rotation|||
|Maximum gradient rotation|||
|Random rotation|||
|Medium alpha|||
|Low alpha|||
|Big needle length|||
|Small needle length|||
|Medium needle width|||
|Big needle width|||
|Angles: 45°, 135°, -45° -135°|||## 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 .