1

I am trying to get sketch effect and i have the imagemagick command line code as follows

convert 1.jpg -colorspace gray   ( +clone -blur 0x8 \) +swap -compose divide -composite  -linear-stretch 2%x20%  cousincs.jpg

I am using gm module and I tried to extend gm,however it is not not accepting parenthesis, failing to recognize -linear-stretch resulting in two blurred images instead of one. I tried node-imagemagick native and wizardry but unable to achieve the desired functionality. Can anyone let me know how can I achieve this. Thanks in advance

Here is the code i tried with gm

  var dir = __dirname + '/kar/';
  var newName=uuid.v4()+".jpg";
  imageMagick("2.jpg")
  .clone()
  .swap()
  .compose('divide')
  .composite()
  .write(dir+newName, function(err,data){console.log("error is ",err)});

Here is the args.js

  proto.clone = function clone () {
  return this.out("\( +clone -blur 0x8\)");
  }

 proto.swap=function swap(){
  return this.out("+swap");
}

proto.composite=function composite(){
  return this.out("-composite  -linear-stretch 2%x20%")
}
ayniam
  • 573
  • 2
  • 8
  • 27
  • Untested, and a bit inefficient, but try `convert 1.jpg -colorspace gray -blur 0x8 1.jpg -colorspace gray -compose divide -composite result.jpg` – Mark Setchell Nov 17 '16 at 03:03
  • Thanks Mark!! I am able to implement this using imagemagick npm but not gm. It helped. – ayniam Nov 17 '16 at 03:48

0 Answers0