Best way to crop and upload image with express?

zobi8225 picture zobi8225 · Jun 19, 2012 · Viewed 9.8k times · Source

i upload image on S3 server with knox on express.

I would like user could crop the image for this profile picture (like on facebook)

I heard about Jcrop for the user interface and imagemagick for the server. For you, what is the best way to do that ?

Sorry for my bad english.

Answer

lc0 picture lc0 · Jun 19, 2012

You can try to use nice library GraphicsMagick for node.js https://github.com/aheckmann/gm

and here is a link to test some function and so on http://aheckmann.github.com/gm/

var gm = require('gm')
  , resizeX = 200
  , resizeY = 400

gm('/path/to/image.jpg')
.resize(resizeX, resizeY)
.write(response, function (err) {
  if (err) ...
});