尝试使用imagemagick
需要同步使用imagemagick。
即只有在图像转换完成后才能执行下一段代码(无论有错误还是成功)
我只看到deasync的一种解决方案:
const ImageMagick = require('imagemagick');
const Deasync = require('deasync');
var finished = false;
ImageMagick.convert(
[
source,
path_to
],
function(err, stdout){
finished = true;
});
Deasync.loopWhile(function(){return !finished;});
// the next code performed only after image convertion will be done
Run Code Online (Sandbox Code Playgroud)
是否有任何变体如何同步使用 imagemagick?