Name: gmachine
Owner: FT Interactive News
Description: Node app to grab images from the internet and resize, crop and compress them.
Created: 2012-10-25 16:05:42.0
Updated: 2015-04-22 19:03:45.0
Pushed: 2013-04-25 21:38:02.0
Size: 144
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A node app to grab images from the internet and resize, crop and compress them. Uses GraphicsMagick (default) or Imagemagick.
Install using GraphicsMagick
$ brew install graphicsmagick
$ node app.js --p 8080
Install using ImageMagick
$ brew install imagemagick
$ node app.js --port 8080 --imagemagick
Call the service like this
http://localhost:8080/{resizeWidth}/{resizeHeight}?crop={cropWidth},{cropHeight},{x},{y}&url={url}
example
The following URL will get the image at http://etc/etc/image.jpg
http://localhost:8080/200/400?crop=100,100,250,150&url=htp://etc/etc/image.jpg
and will crop a 100px x 100px square at coordinates x=250px, y=150px. The cropped image will then be resized to 200px x 400px.
crop
is an optional param. To crop without resizing, set the the resize dimensions to 0.
Add an optional cm=20
query param to set jpeg compression to 20. Value should be between 0-100. Defaults to 80.
Add an optional m
query param with any value to retain Exif. All metadata is removed by default.
-p --port
Set the port number. Defaults to 3000. On Heroku the port will be entered via process.env.PORT
-i --imagemagick
Use ImageMagick instead GraphicsMagickTo deploy to heroku copy and paste the following into a terminal
$ git clone https://github.com/ft-interactive/gmachine.git; cd gmachine; heroku create; git push heroku master
TODO