ft-interactive/gmachine

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

Homepage:

Size: 144

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

gMachine

A node app to grab images from the internet and resize, crop and compress them. Uses GraphicsMagick (default) or Imagemagick.

Demo App

Installation

Install using GraphicsMagick

$ brew install graphicsmagick
$ node app.js --p 8080

Install using ImageMagick

$ brew install imagemagick
$ node app.js --port 8080 --imagemagick
Usage

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.

Start-up Options
Deploying to Heroku

To 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


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.