image crop

Image crop code examples.

There is 1 snippet with the image crop tag

  • Crop an Image using ImageMagick and node.js

    Crop an image using node.js and the imagemagick node module. The module's convert method is used, where native ImageMagick arguments are passed in as an array. Size, offset and an input image path are supplied to produce a cropped output PNG, which is written to file.

    var http = require("http");
    var im = require("imagemagick"); 
    
    var args = [
      "image.png",
      "-crop",
      "120x80+30+15",
      "output.png"
    ];
    
    var server = http.createServer(function(req, res) {
    
      im.convert(args, function(err) {
        if(err) { throw err; }
        res.end("Image crop complete");
      });
    
    }).listen(8080);
    26 Aug 2013