Results 1 to 3 of 3

Thread: GetPixel Question

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Location
    Stoke-on-Trent, England
    Posts
    1

    Question GetPixel Question

    Hi,

    Have been lurking on this forum for about a year now, but up until now every question I have had has been answered by previous posts (rather well as I may add ). My question is this: -

    Is it possible to use GetPixel on an image still in memory? What I am trying to do is scan the picture for a red pixel and then load the image into a picture box at the coordinates of the pixel. (In this case it's text surrounded by a red checked box)

    At the moment I am loading a bitmap into a StdPicture, but for GetPixel to work you need the hWnd for it, so my next thought would be to use iPicture instead as it does have a handle, but again fails due to iPicture using Himetrics. The other option is the GetDC functions, but I don't really know how to use it or if it can be manipulated to do it.

    Any help is appreciated, even it's tp say that it can't be done!

    Many Thanks

    Xcelsior
    Machina improba! Vel mihi ede potum vel mihi redde nummos meos!

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: GetPixel Question

    Have you considered the GetDIBits() API function? Much faster. There's an example of using it in the Image Comparison link in my signature.

    Once the pixels are dumped into a byte array you can just check the byte values.

    Sorry, I'm not sure how to use GetPixel on an StdPicture object. It has been done before, because I've seen it on www.pscode.com/vb but I'm not much of a GDI programmer.

  3. #3
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: GetPixel Question

    I recommend you to visit Http://www.mvps.org/EDais/ and downlod the small ebook on 'Basic introduction to
    Graphics programming in VB' . A very good one. Might be helpfull in your case.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width