unicornify

1.0.0 • Public • Published

unicornify for node

Pixelated unicorns for your server.

I did not write the actual rendering for this. It's just a node binding to the python-based unicornify with some control layered on top.

Needs python and graphicsmagick.

sudo apt-get install python graphicsmagick

If you're not Debian I'm sure you can figure it out.

Stream (raw) usage

var unicornify = require('unicornify');
    
unicornify('some hash goes here', { // these are the default options
	width: 512, // obvious
	height: 512, // obvious, but must be <= width
	crop: 0, // 0.0-1.0, how much width% to slice form the top
	pixelationFactor: 4, // how pixelated the resulting image will be -- higher: more pixelated, faster to render
	saturation: 0.7, // 0.0-1.0, how saturated the resulting image will be -- the raw image (1) is pretty intense
	format: 'png' // the file format for output -- supports whatever gm supports, which is pretty much everything
}).readStream(function(err, s) {
	if (!err) {
		s.pipe(process.stdout); // do whatever with the stream -- it's the raw binary data for the image
	} else {
		throw err; // debugging time
	}
});

Express/connect/httpServer usage

You can also run this thing seamlessly as an express/connect app:

var unicornify = require('unicornify'), express = require('express');
    
express().get('*', unicornify.app({
	// optional options -- accepts the same thing as above
})).listen(1234);

Using it like this, the resulting images will be based on the request url.

Command line usage

Accepts

$ ./unicornify.js "some hash" 512 8 >lol.png

Notes

There are no background rainbows in this version of unicornify. They were too insane and unclean so they're completey gone from this version. Might make this an option in the future.

Readme

Keywords

none

Package Sidebar

Install

npm i unicornify

Weekly Downloads

1

Version

1.0.0

License

none

Last publish

Collaborators

  • kazmer