【问题标题】:Nodejs image crop by coordinatesNodejs图像按坐标裁剪
【发布时间】:2015-08-18 03:55:10
【问题描述】:

有没有办法在裁剪图像时提供 x、y 坐标。

目前我使用的是Imagemagick

im.crop({
    srcPath: upload_path+media_file_name,
    dstPath: upload_path+"thumb_"+media_file_name,
    width: 350,
    height: 210,
    quality: 1,
    gravity: 'Center'
}, function(err, stdout, stderr){

};

此代码有效,但我对xy 坐标不满意。我想用于图像裁剪的以下输入

height:360
width:360
x:180
y:300

【问题讨论】:

    标签: node.js image imagemagick crop


    【解决方案1】:

    我不会说节点,但是你可以使用原始界面吗?它看起来像

    im.convert(['inputimage.jpg','-crop','350x200+x+y','output.jpg'],
       function(...)
    

    xy 输入您自己的号码。

    【讨论】:

    • 感谢您的建议。是的,命令运行良好。 convert -crop 360x360+180+300 profile.jpg testisng.jpg 你已经解释过了。干杯。
    猜你喜欢
    • 2016-12-09
    • 1970-01-01
    • 2013-05-10
    • 2021-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-19
    相关资源
    最近更新 更多