Today I wanted to investigate ImageMagick for some tasks involving image analysis. Analyzing for certain colors in parts of an image is one application that I'd like to explore. I do know that PHP has some features that can interoperate with ImageMagic. GDlib, another image library, works with PHP.

There is the compare function, which obviously compares two images and shows where they are alike. You can give the compare function two images as input and it will then produce an image that shows the difference in red.

If you scroll down to the bottom of the page that describes the compare function, it describes a feature which can give some statistics based on the findings of the compare command. There are a number of different metrics available. 

Let's also take a look at imagecolorat, a PHP function that can take two image coordinates and return the color of the pixel specified by those coordinates. This seems particularly useful for a few things I'd like to do with regard to recognizing if certain things are present in web page screen shots. I didn't read up on this function, but my initial impression of the page tells me it uses GD instead of Imagemagick.

imagecolorstotal is another PHP function that deals with the detection of colors in an image. It simply returns the number of colors in an image.

Imagick::getImageResolution is a PHP function which uses ImageMagick to get the X,Y coordinates of an image.


Comments (0)

No comments found!

Write new comment