【问题标题】:how to find center of image using php imagemagick如何使用 php imagemagick 找到图像的中心
【发布时间】:2014-10-27 11:44:42
【问题描述】:

我想使用 php5 和图像处理库 imagemagick 来定位图像的中心。我有 imagemagick,并安装了 php 库,但我才刚刚开始,并且在示例中磕磕绊绊。我还没有发现任何尖叫的东西,嘿,这是怎么做的!为了同样的效果,我想知道如何使用 imagemagick 找到图像的 X 和 Y 尺寸的长度,因为这样我就可以计算出中心位置。有人可以帮我解决这个问题吗?

【问题讨论】:

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


    【解决方案1】:

    这是你的回答:

    $image = new Imagick("picture.jpg");
    $width = $image->getImageWidth();
    $height = $image->getImageHeight();
    
    $center_width = $width / 2;
    $center_height = $height / 2; 
    

    现在您有了图像中心的坐标!如果您需要进一步的帮助,请告诉我。

    【讨论】:

    • 这真的很有帮助。谢谢。
    猜你喜欢
    • 2021-08-11
    • 2012-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-17
    • 2017-03-06
    • 1970-01-01
    相关资源
    最近更新 更多