Page 2 of 2

Re: How to process each pixel of the image maximally quickly?

Posted: 2017-02-21T13:23:05-07:00
by dlemstra
You are getting all the pixels for each row. You might want to change your loop into something like this:

Code: Select all

using (PixelCollection pc = img.GetPixels())
{
  int channelsCount = pc.Channels;
  for (int y = 0; y < img.Height; y++)
  {
    var pcv = pc.GetArea(0, y, img.Width, 1);
    for (int x = 0; x < pcv.Length; x += channelsCount)
    {