imagemagick tile image with Coordinate

369 views Asked by At

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.

1

There are 1 answers

0
Profstyle On BEST ANSWER

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"

];