Skip to content

Latest commit

History

50 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

About

For GET requests, dynamically crops and resizes image using ImageMagick convert command. And, serves the resized image.

The following crops 1:2 rectangle at center of some/image.jpg. And resizes the crop to 10x20:

GET /some/image.10x20.jpg

You can specify where to crop other than center. The following crops at the top (north).

GET /some/image.10x20n.jpg

You can specify crop size in percentage (defaults to 100%):

GET /some/image.10x20n.70.jpg

would crop 1:2 rectangle that'll fit about 70% of original image.

Other parameters:

ParameterCrops AtExampleComment
CenterGET /some/image.10x20.jpgNot specifying a parameter crops at center.
nNorthGET /a/b.100x400n.jpg
sSouthGET /a/b.100x400s.jpg
wWestGET /a/b.100x400w.jpg
eEastGET /a/b.100x400e.jpg
nwNorthWestGET /a/b.100x400nw.jpg
neNorthEastGET /a/b.100x400ne.jpg
swSouthWestGET /a/b.100x400sw.jpg
seSouthEastGET /a/b.100x400se.jpg
tNo CropGET /some/image.100x400t.jpgInstead of cropping, some/image.jpg is resized to fit in 100x400 rectangle.

Example

Quickstart

Run

node src/main.js

Configure

cp src/settings.js src/settings.local.js
vim settings.local.js

Example settings.local.js:

module.exports = {
port: 8081,
srcDir: '/var/www',
destDir: '/var/cache',
convertcmd: '/usr/local/bin/convert'
}

About

No description, website, or topics provided.

Resources

Stars

21 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages