dummage

0.2.0 • Public • Published

dummage

dummage is a dummy image generator

Getting started

This module depends on gm, so first, you should download and install GraphicsMagick.

In Mac OS X

brew install graphicsmagick

then

npm install dummage

And, add some image to "./img/#{theme}", you can get "/dummage/#{theme}".

use Express

var dummage = require("dummage")();
var app = require("express")();
app.use( dummage.middleware() );
app.listen(3000, function(){
	console.log("listen 3000")
});
  • http://localhost:3000/dummage/any: random image

  • http://localhost:3000/dummage/blank: blank image

  • http://localhost:3000/dummage/person: random person image

  • http://localhost:3000/dummage/person/300x200: random person image(crop 300px x 200px)

without Express

var dummage = require("dummage")();

dummage.any(function(err,data){
	// random image
});
dummage.blank(function(err, data){
	// blank image
});

dummage.routes("person", function(err, data){
	// random person image
});

Option

  • root: dummy image path root (dafault: "dummage")

Photo

Thanks to these website.

To reduce module size

find . -name "*jpg" -exec convert {} -resize 640x640 {} \;  

crop

  • http://localhost:3000/dummage/any/400x200: crop image (gravity is "Center")

colorize

"colorize" use gm#colorize

  • http://localhost:3000/dummage/any:0x001313: colorize image (to Red)
  • http://localhost:3000/dummage/any:0x001313/600x200: colorize image and crop you can add hex after ":". Then separate hex to RGB.

use stand-alone

If you want to use dummage with stand-alone mode

npm install -g dummage

Then you can use Commandline Interface.

% dummage -p 8888

You can access http://localhost:8888/dummage/any and so on.

Why I make this ?

Yes, there are many dummy image service, but I think those are too slowly to give a presentation of prototype. I need more quicky dummy image generator.

Readme

Keywords

none

Package Sidebar

Install

npm i dummage

Weekly Downloads

7

Version

0.2.0

License

MIT

Last publish

Collaborators

  • satkaku