【问题标题】:Imagemagick inline border without resizing the original imageImagemagick 内嵌边框而不调整原始图像的大小
【发布时间】:2018-09-12 06:58:11
【问题描述】:

我尝试使用以下代码为尺寸为 200x200 像素的图像添加边框。

convert -border 2x2 -bordercolor "#cccccc" old.png new.png

上面的代码在 old.png 周围添加了一个 2 px 的边框。因此,图像扩展为 204x204 像素。

但是,我想添加一个 inline 边框。我对旧图像的边框覆盖边缘部分没有任何问题。因此,新图像应该能够保留 200x200 像素的尺寸。请告知具体该怎么做。

【问题讨论】:

    标签: image-processing image-manipulation imagemagick-convert


    【解决方案1】:

    您需要在周围刮掉两个像素,然后添加一个两个像素的边框。您应该使用 Imagemagick 6 尝试此操作。如果使用 Imagemagick 7,请将 convert 替换为 magick。

    convert old.png -shave 2x2 -bordercolor "#cccccc" -border 2 new.png
    

    【讨论】:

      猜你喜欢
      • 2016-08-08
      • 1970-01-01
      • 2014-08-22
      • 2013-10-19
      • 1970-01-01
      • 1970-01-01
      • 2011-07-24
      • 2012-05-29
      • 2012-07-26
      相关资源
      最近更新 更多