PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Image Processing PPC
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Image Processing PPC
![]() |
Image Processing PPC |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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...framework?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). "digiwizard" <digiwizard@discussions.microsoft.com> wrote in message news:028334F0-0D62-4EB1-8FAB-A2208A408387@microsoft.com... >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. > > > > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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~ "Ilya Tumanov [MS]" wrote: > 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...framework?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). > > "digiwizard" <digiwizard@discussions.microsoft.com> wrote in message > news:028334F0-0D62-4EB1-8FAB-A2208A408387@microsoft.com... > >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. > > > > > > > > > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

