Faster method for scrolling an image

Does anyone know how to get this to work faster? Can I do the same with Lockbits?

for (int y = 0; y < picture.Height; y++)
{
    for (int x = 0; x < picture.Width; x++)
    {
         Color colorPixel = picture.GetPixel(x, y);

         if ((colorPixel.A > 230) &&
            (colorPixel.R < 20) &&
            (colorPixel.G < 20) &&
            (colorPixel.B < 20))
            {
                    //do something
            }

      

Thank.

+2


source to share


1 answer


Here's a post on comparing to images in C # pretty quickly. It starts with a rather slow version (which is still better than GetPixel) and ends with a version that is 25 times faster:



http://danbystrom.se/2008/12/14/improving-performance/

+2


source







All Articles