【问题标题】:merge 2 images with node.js and gm将 2 个图像与 node.js 和 gm 合并
【发布时间】:2013-01-22 15:32:35
【问题描述】:

我想使用 node.js 和一个 gm 来合并 2 个图像。事实上,我想将一个较小的图像放在一个较大的图像上的坐标 x,y 上。

我已经尝试过使用 append(),但我无法选择将第二张图片放在第一张图片上方

这是我追加的js代码。

gm('img/vector/test.svg').append('img/base/test.png').write('img/final/test.png', function(err, stdout, stderr, command){
            if (err){
                console.log('image conversion error!'); 
                console.log(err); 
                console.log(command);    
            }else{ 
                console.log('image converted with command :'); 
                console.log(command);
            } 
        })

【问题讨论】:

    标签: javascript node.js png graphicsmagick


    【解决方案1】:

    “此选项创建单个图像,其中原始集中的图像从上到下堆叠”gm doc

    通常我会说看看montage,但节点模块似乎不支持...

    【讨论】:

    • 我终于找到了一个使用蒙太奇的方法: gm('img/base/'+baseFileName+'.png') .subCommand('montage') .texture('img/vector/svg-'+ scorePercent+'.svg') .geometry(81, 81) .font('Arial', 18) .fill(textColor) .drawText(textPos, 60, textLabel) .write('img/final/'+baseFileName+'.png ', 函数(...)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-06
    • 2020-05-29
    • 2020-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多