All Projects → Datamosh-js → datamosh

Datamosh-js / datamosh

Licence: MIT license
✨💾 Edit images via buffers. 💯✨

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to datamosh

Online-News-Portal-with-Django
Daily News For You is an online news portal developed by Django and SQLite
Stars: ✭ 45 (+95.65%)
Mutual labels:  cat
EmbeddedRingBuffer
A ring buffer designed to work with embedded devices, does not use heap allocations.
Stars: ✭ 47 (+104.35%)
Mutual labels:  buffer
sharon
A lightweight and modular social sharing library
Stars: ✭ 16 (-30.43%)
Mutual labels:  buffer
SwiftObserver
Elegant Reactive Primitives for Clean Swift Architecture #NoRx
Stars: ✭ 14 (-39.13%)
Mutual labels:  callback
proposal-function-helpers
A withdrawn proposal for standardizing some useful, popular helper functions into JavaScript’s Function object.
Stars: ✭ 41 (+78.26%)
Mutual labels:  callback
keras-stochastic-weight-averaging
Keras callback function for stochastic weight averaging
Stars: ✭ 53 (+130.43%)
Mutual labels:  callback
image-cache
NodeJS Image cache with Base64 format
Stars: ✭ 18 (-21.74%)
Mutual labels:  callback
popc
Popc manager for vim & neovim
Stars: ✭ 17 (-26.09%)
Mutual labels:  buffer
async-chainable
An extension to Async adding better handling of mixed Series / Parallel tasks via object chaining
Stars: ✭ 25 (+8.7%)
Mutual labels:  callback
json-viewer
Pretty JSON viewer for the terminal
Stars: ✭ 26 (+13.04%)
Mutual labels:  cat
JABS.nvim
Just Another Buffer Switcher for Neovim
Stars: ✭ 150 (+552.17%)
Mutual labels:  buffer
CuVec
Unifying Python/C++/CUDA memory: Python buffered array ↔️ `std::vector` ↔️ CUDA managed memory
Stars: ✭ 73 (+217.39%)
Mutual labels:  buffer
buffertools-php
Toolbox for working with binary and hex data. Similar to NodeJS Buffer.
Stars: ✭ 60 (+160.87%)
Mutual labels:  buffer
sirdez
Glorious Binary Serialization and Deserialization for TypeScript.
Stars: ✭ 20 (-13.04%)
Mutual labels:  buffer
lambda-layer-canvas-nodejs
AWS Lambda Layer with node-canvas and its dependencies packaged, provides a Cairo backed Mozilla Web Canvas API implementation
Stars: ✭ 36 (+56.52%)
Mutual labels:  manipulate-images
RingBuffer
Classic ringbuffer with optional Stream interface
Stars: ✭ 53 (+130.43%)
Mutual labels:  buffer
ant-arduino
An implementation of a ANT driver for Arduino, Mbed and ESP-IDF
Stars: ✭ 69 (+200%)
Mutual labels:  callback
unkillable-scratch
Disallow the *scratch* buffer from being killed
Stars: ✭ 13 (-43.48%)
Mutual labels:  buffer
c-struct
a binary data packing & unpacking library for node.js
Stars: ✭ 42 (+82.61%)
Mutual labels:  buffer
react-redux-cats
React and Redux with cats
Stars: ✭ 23 (+0%)
Mutual labels:  cat

Datamosh License: MIT code style: prettier Build Status

datamosh_cover_2x

Mess around with image data using buffers, create some interesting & artistic results, profit.

Install

$ npm install datamosh

Usage

const mosh = require("datamosh");

let imgBuff = await readFile("/full/path/to/image.png");

let moshedBuff = await mosh(imgBuff, "vaporwave");

Reading/Writing the moshed image

mosh("~/image.png", null, "~/moshed_image.png");

// because mode is null, a random mode will be chosen

Moshing a buffer with callbacks

const cb = (err, data) => {
  if (!err) writeFile("/path/to/out.gif", data);
};

mosh(imgBuff, "vana", cb);

Using multiple modes on a single image, applied with respect to order.

let moshedBuff = await mosh(imgBuff, ["fatcat", "vaporwave", "walter"]);

// ['vana', null, null] is also valid => ['vana', random, random]

API

mosh(source, mode?, cb|writePath?)

Takes input source Buffer/Path, returns an encoded Buffer with the applied modes.

  • mode, the mosh mode to apply to the source image. Multiple modes may be passed using an array of modes. Any null values are replaced with a random mode.
  • cb (err, data), when using callbacks.
  • writePath, the path to write the moshed image to.

Paths may use the tilde (~) character. Datamosh validates read and write paths, replacing tilde with the path to the home directory.

~/Desktop/moshes/ -> /home/youruser/Desktop/moshes

Custom Modes

Datamosh allows you to set custom moshing modes. As of v1.1.0, this may be acomplished by adding a mosh function to the MODES property.

For mosh function starter code, see the included template file located here.

const datamosh = require("datamosh");

function newMode(data, width, height) {
  // your cool code goes here!

  return data;
}

datamosh.MODES.newMode = newMode;

Example Images

mode:fatcat Fatcat was created by user @mster

mode:vaporwave Vaporwave was created by user @tlaskey

mode:blurbobb

mode:veneneux

Datamosh in the wild

Check out this list of awesome apps that use datamosh!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].