Search code examples
phpimage-processingimagick

Image statistics in PHP: average column values


I want to calculate the average pixel values in each column of an image. I am considering using ImagickPixelIterator Imagick::getPixelIterator but, if I understand it correctly, it iterates row by row.

Do you think it is a good way to face the problem? Do you know a better way?


Solution

  • Use the image library of your choosing to resize the image to be 1 pixel high, after that you just read the pixels to have average column colors. Good luck!