Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including express-thumbnail with all npm packages installed. Try it out:

var expressThumbnail = require("express-thumbnail")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

express-thumbnail v0.2.4

Express framework middleware for creation of thumbnails on the fly

Express Thumbnail

Express thumbnail is a Express framework middleware for creation of thumbnails on the fly. It automatically creates a thumbnails by adding query parameters onto a image url.


This module use lwip, which didn't require external runtime dependencies for image processing. It means you don't have to install anything else on your system.


$ npm install express-thumbnail


var express = require('express');
var expressThumbnail = require('express-thumbnail');
var app = express();
app.use(expressThumbnail.register(__dirname + '/images'));
<img src="foo.png?thumb=50x50">


expressThumbnail.register(rootDir, [options])

rootDir path to images root directory.

options (optional) an object of options. Available options:

  • cacheDir The location where converted images will be stored. Default is [rootDir]/.thumb.
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free