使用ImageMagick查找图像文件的空白区域

时间:2021-03-26 08:57:55

I need to be able to determine if a part of an image (outside of predetermined crop marks) contains any image content.

我需要能够确定图像的一部分(在预定裁剪标记之外)是否包含任何图像内容。

Is there a way with ImageMagick (specifically the php interface) to do this?

有没有办法使用ImageMagick(特别是php界面)来做到这一点?

Scenario: The canvas is 8.5x11 with .5 in margins on the top, left, and bottom edges and a 1 in margin on the right edge. The image needs to fit within the crop marks for printing.

场景:画布为8.5x11,顶部,左侧和底部边缘的边距为0.5,右边缘的边距为1。图像需要适合裁剪标记以进行打印。

Normally I use Photoshop actions to do this, but I am trying to automate the process.

通常我使用Photoshop操作来执行此操作,但我正在尝试自动执行此过程。

1 个解决方案

#1


2  

Replace everything within crop marks with black/white rectangle, do a histogram of the resulting image and analyze it?

用黑/白矩形替换裁剪标记内的所有内容,对结果图像进行直方图分析并进行分析?

I can do this with command-line version of ImageMagick, but dont know how to express it with PHP api.

我可以使用命令行版本的ImageMagick来做到这一点,但不知道如何使用PHP api表达它。

#1


2  

Replace everything within crop marks with black/white rectangle, do a histogram of the resulting image and analyze it?

用黑/白矩形替换裁剪标记内的所有内容,对结果图像进行直方图分析并进行分析?

I can do this with command-line version of ImageMagick, but dont know how to express it with PHP api.

我可以使用命令行版本的ImageMagick来做到这一点,但不知道如何使用PHP api表达它。