<commit_before>Glitchy 3 Bit Dither
==============

Test this online with <a href="http://jkirchartz.com/Glitchy3bitdither/GlitchCruiser.html" title="Glitch Cruiser">Glitch Cruiser</a>.

<p>This is a commandline and web-based utility to mutilate images in unpredictable ways. It can randomly choose between algorithms, and many algorithms randomly mutate themselves.
    You can choose different encodings, effects, and emulate several glitch techniques, resulting in aleatoric new images and hidden configurations.</p>
</p>
<p>Check out some curated images at <a href="http://glitches.jkirchartz.com/">glitches.jkirchartz.com</a></p>
<p>This web-based utility completely client-side, using the FileReader and canvas APIs, your image isn't being uploaded to any server. If you have a decent browser, this should work. Also, you can right-click and save the result of the processing.</p>
<p>Based on <NAME>'s <a href="https://github.com/mncaudill/3bitdither">3bitdither</a></p>
<p>Heavily modified by JKirchartz, <a href="https://github.com/jkirchartz/Glitchy3bitdither">code on github</a></p>
<p>Experimental functions may not be 100% stable, this is a work in progress.</p>

## Usage

### use this as a command-line utility

install with `npm install -g git@github.com/jkirchartz/Glitchy3bitDither`

then run `gleech glitch <input image> <output image> <glitch function name> [optional: parameters]`

for example: `gleech glitch test.jpg output.jpg fractal` to allow the fractal function to choose it's own parameters OR `gleech.glitch test.jpg output.jpg fractal 0` to choose fractal type 0 (alternatively you can choose 1)


### using this as a node package

install with `npm install --save git@github.com/jkirchartz/Glitchy3bitDither`

and import it into your project for use like so:

```javascript
'use strict';
var gleech = require('gleech');

gleech.read('test.jpg', function(err, image) {
	image.fractal().write('output.jpg');
});
```
## Additional Information

Gleech is based on [JIMP][https://github.com/oliver-moran/jimp] and (theoretically) any JIMP function can be used in place of a glitch function.

run `gleech list` to see all available function names.


## todo:

1. update site (and gh-pages branch) to use `dist/gleech.js` instead of `site/js/Glitchy3bitDither.js`
1. optimize code w/ better code from the row-sorting algos
2. web workers
3. namespace
4. better function names
5. better comments
7. Add glitches:
  - scan lines (1px black line the entire width every N lines)
  - move each "row" in opposite directions (1px at a time)
  - kaleidoscope<commit_msg>add item to TODO: add blend modes<commit_after>Glitchy 3 Bit Dither
==============

Test this online with <a href="http://jkirchartz.com/Glitchy3bitdither/GlitchCruiser.html" title="Glitch Cruiser">Glitch Cruiser</a>.

<p>This is a commandline and web-based utility to mutilate images in unpredictable ways. It can randomly choose between algorithms, and many algorithms randomly mutate themselves.
    You can choose different encodings, effects, and emulate several glitch techniques, resulting in aleatoric new images and hidden configurations.</p>
</p>
<p>Check out some curated images at <a href="http://glitches.jkirchartz.com/">glitches.jkirchartz.com</a></p>
<p>This web-based utility completely client-side, using the FileReader and canvas APIs, your image isn't being uploaded to any server. If you have a decent browser, this should work. Also, you can right-click and save the result of the processing.</p>
<p>Based on <NAME>'s <a href="https://github.com/mncaudill/3bitdither">3bitdither</a></p>
<p>Heavily modified by JKirchartz, <a href="https://github.com/jkirchartz/Glitchy3bitdither">code on github</a></p>
<p>Experimental functions may not be 100% stable, this is a work in progress.</p>

## Usage

### use this as a command-line utility

install with `npm install -g git@github.com/jkirchartz/Glitchy3bitDither`

then run `gleech glitch <input image> <output image> <glitch function name> [optional: parameters]`

for example: `gleech glitch test.jpg output.jpg fractal` to allow the fractal function to choose it's own parameters OR `gleech.glitch test.jpg output.jpg fractal 0` to choose fractal type 0 (alternatively you can choose 1)


### using this as a node package

install with `npm install --save git@github.com/jkirchartz/Glitchy3bitDither`

and import it into your project for use like so:

```javascript
'use strict';
var gleech = require('gleech');

gleech.read('test.jpg', function(err, image) {
	image.fractal().write('output.jpg');
});
```
## Additional Information

Gleech is based on [JIMP][https://github.com/oliver-moran/jimp] and (theoretically) any JIMP function can be used in place of a glitch function.

run `gleech list` to see all available function names.


## todo:

1. update site (and gh-pages branch) to use `dist/gleech.js` instead of `site/js/Glitchy3bitDither.js`
1. optimize code w/ better code from the row-sorting algos
2. web workers
3. namespace
4. better function names
5. better comments
7. Add glitches:
  - scan lines (1px black line the entire width every N lines)
  - move each "row" in opposite directions (1px at a time)
  - kaleidoscope
8. Add blend modes: https://en.wikipedia.org/wiki/Blend_modes
{'fraction_non_alphanumeric': 0.10810810810810811, 'fraction_numerical': 0.008945565283593453, 'mean_word_length': 4.781078107810781, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3646944', 'n_tokens_mistral': 1656, 'n_tokens_neox': 1600, 'n_words': 634}