0

I want to develop image contrast,sharpen,warmth,crop,undo,redo functionality in my web application. Please tell me how can I develop this functionality ? I dont want to use .GetPixel() and .SetPixel() because it is very slow metho. so please tell me any other way to develop these functionalities.

Thanks in Advance.

Neel Patel
  • 11
  • 1
  • 2

1 Answers1

0

If you need faster access to the pixel data on an image, use Image.LockBits. Note that any method containing this code must be marked unsafe.

BitmapData bitmapData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);
int* bitmapPtr = (int*)bitmapData.Scan0.ToPointer();

for (int pixelCount = 0; pixelCount <= image.Width * image.Height; pixelCount++)
{
    bitmapPtr[pixelCount] = ...;
    // etc
}

image.UnlockBits(bitmapData);
Simon MᶜKenzie
  • 8,344
  • 13
  • 50
  • 77