node.jsimagemagickimagemagick-convertnode-imagemagick

imagemagick tile image with Coordinate


Using imagemagick with nodejs, I would like to rename my output with x-y by column and rows.

i can do on terminal but how can i implement this on my script as well.

Terminal example :

convert img.jpg -crop 512x512 -set filename:tile ./tiles/pano-%[fx:page.x/256]-%[fx:page.y/256] %[filename:tile]-0.jpg

var args = [
  query.url+".jpg",          // image 
  "-crop",            // will crop the tiles
  "512x512",          // size of tile will be created
  query.url+"/output.jpg"        // Image output name.
];

im.convert(args, function(err) {
    if(err) { throw err; }
    res.end("Image crop complete");
  });

}

Or can you suggest me anyother way to tile my image.


Solution

  • Ok i found the solution, This might help for other if they need.

    var args = [
      query.url+".jpg",   // image location
      "-crop",            // will crop the tiles
      "512x512",
      "-set",
      "filename:tile",
      query.url+"/pano-%[fx:page.x/512]-%[fx:page.y/512]",         
      "%[filename:tile]-0.jpg"
    
    ];