Re: I used to use VB but...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Mike Williams" <mikea@xxxxxxxxxxxxxxxxx> wrote in message
news:eDsi0PALIHA.4228@xxxxxxxxxxxxxxxxxxxxxxx
You can do it pretty fast in VB6 using GetDIBits to dump it into an array
and working on the array, and you can do it even faster still by getting
the address of the existing bitmap in memory and pointing a SAFEARRAY
structure at it so that you are working directly on the bitmap data in
memory without needing to move it anywhere.

Using the latter method in VB6 I can (for example) modify either the R, G
or B component of a 1024 x 768 pixel 24 bit bitmap on a pixel by pixel
basis in about 27 milliseconds on my fairly standard (and slow by today's
standards) AMD 2.2Ghz machine. That's almost 40 such bitmaps per second,
or about 28 megapixels per second. What sort of "pixel by pixel" speed
are you talking about in Dot net?

I haven't got an exact speed but will give it a try. With C# at least (not
vb.net) you can do pointer manipulation directly so I believe you will get
similar speed to C++. With VB6 and GetDIBits you are doing a copy of the
bitmap (according to help on GetDIBits) so C# should be around twice as
fast.

Michael


.



Relevant Pages

  • Re: How to convert image from Format1bppIndexed to Format24bppRgb?
    ... bitmap will also be a 1bpp bitmap. ... case of conversion to any indexed type you need to understand the pixel ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... > of trying to create the 24bpp and generating an "out of memory" error, ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Faster GetPixel() type method?
    ... not via GetPixel. ... bitmap look into CreateDIBSectionor GetDIBits. ... Once you get the DI-Bitmap into your own memory, getting a pixel ...
    (microsoft.public.vc.mfc)
  • Re: memory leak
    ... ArgumentException on Full Framework) when I have a ton of virtual memory ... "new Bitmap" line. ... Dispose is not a required call - it is optional. ... you are done with those resources. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Faster GetPixel() type method?
    ... not via GetPixel. ... For an in-memory bitmap look into CreateDIBSectionor GetDIBits. ... Once you get the DI-Bitmap into your own memory, getting a pixel becomes an address arithmetic operation. ... For best speed, you really don't want to go through all this addressing for each pixel, so you get the address of the first line of pixels and simply increment a pointer through it processing each pixel. ...
    (microsoft.public.vc.mfc)
  • Re: Getting access to pixels within a bitmap
    ... GetDIBits would be a good start. ... >compare pixel by pixel for changes. ... I would load the bitmap and convert it to greyscale so I only ... >HBITMAP hBitmap = NULL; ...
    (microsoft.public.vc.mfc)