Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.02 KB

README.md

File metadata and controls

52 lines (34 loc) · 1.02 KB

Moshbench

A CLI tool for prototyping new Datamosh modes.

What the heck is a Datamosh?

https://github.com/Datamosh-js/datamosh

Usage

Clone, edit, run!

Clone

Clone the moshbench-cli repo.

Edit

Edit mosh.js, found in the root of the project. This will be the code you use for your new Datamosh mode.

Starter code has been provided. As long as your mode returns an array of numbers [0,254], Datamosh will cover the rest.

module.exports = function (data, width, height) {
  // example: red-shift image
  for (let i = 0; i < data.length; i += 4) {
    // red = data[i]
    // green = data[i + 1]
    // blue = data[i + 2]
    // alpha = data[i + 3]

    data[i + 1] = 0
    data[i + 2] = 0
  }

  return data
}

Run

Run your new mode using Moshbench!

mosh <readPath> <writePath>

All you need is an image (and it's path) you wish to apply your new mode to.

For example:

$ chmod +x ./moshbench.js # allow exec
$ ./moshbench.js mosh ~/path/to/my/image.jpg ~/path/to/my/moshed-image.jpg