【问题标题】:Add transparent color layer to b&w image using ImageMagick使用 ImageMagick 将透明颜色图层添加到黑白图像
【发布时间】:2017-02-13 22:22:33
【问题描述】:

我正在尝试拍摄一张黑白图像并在顶部添加一个红色透明层。类似于图片的东西。有谁知道我如何使用 gm 在 Node 中使用 ImageMagick 来做到这一点?

【问题讨论】:

  • 如果红色层是透明的,你就看不到了!您的示例中的白色措辞来自哪里 - 为什么没有变红?
  • 在 imagemagick 中,我会使用 -blend 或 -colorize 但我不知道 gm 中会是什么;但它应该会给你一些搜索的东西。

标签: node.js imagemagick gm


【解决方案1】:

我接受了@Bonzo 的建议并使用了 blend。使用 Node gm,您可以直接调用 ImageMagick 方法。

const gm = require('gm');
const im = gm.subClass({ imageMagick: true });

im()
.command('composite')
.in('-blend', '100x100')
.in('-gravity', 'center')
.in('/tmp/top.png')
.in('/tmp/bottom.png').toBuffer('PNG',function (err, buffer) { }

【讨论】:

    猜你喜欢
    • 2016-02-05
    • 2015-03-18
    • 2012-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-13
    • 2020-03-09
    • 2017-11-22
    相关资源
    最近更新 更多