Image Processing PPC

G

Guest

I have an C# PPC app and am experiencing extream lag time when manipulating
pixel values in an Image object. Is there a way to make the GetPixel /
SetPixel operation faster ?

my image is 144x256 pixel and takes about 3 minutes to simply invert the
colors using the following code:

**********************************************************
if (chkInvert.Checked)
{
Color tmpclr, newClr;
int r, g, b;
Bitmap img2Invert = new Bitmap(pictureBox1.Image);

//loop through the image and invert each pixel
for (int iy = 0; iy < img2Invert.Height; iy++)
for (int ix = 0; ix < img2Invert.Width; ix++)
{
tmpclr = img2Invert.GetPixel(ix, iy);
r = 255 - tmpclr.R;
g = 255 - tmpclr.G;
b = 255 - tmpclr.B;
newClr = Color.FromArgb(r, g, b);
img2Invert.SetPixel(ix, iy, newClr);

}

pictureBox1.Image = img2Invert;
}

************************************************************

Help with this would be much appreciated.
 
I

Ilya Tumanov [MS]

No, there's no way to make Get/SetPixel faster. Please use LockBits and
access bitmap data directly instead (NETCF V2 only).


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
G

Guest

Thanks! I appriciate the help...^_^

If you could provide an example of LockBits it would be great -- meanwhile
I'll query msdn for it. :]

~Digiwizard~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top