Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8739417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:56:03+00:00 2026-06-13T10:56:03+00:00

well, i wonder if one writes code to show a bitmap on a form.

  • 0

well, i wonder if one writes code to show a bitmap on a form.
Would it be possible to access it directly like an array in c#?

I am wondering this because the bitmap is already there in memory and on screen.
But I’m not sure on how to point to it; like it where a pointer or array so, I want to do this in c# and I also don’t know the array data structure on the form (like is it RGB BGR / RGB24 etc)

As a note, this image source isn’t from a file, it’s from a webcam.
Also, a reason I want to do this is because getpixel / putpixel is to slow for what I want.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:56:04+00:00Added an answer on June 13, 2026 at 10:56 am

    If you want to get the image pixels in the array you can do it like this:

                Bitmap image = new Bitmap("somebitmap.png");
                Rectangle area = new Rectangle(0,0,image.Width, image.Height);
                BitmapData bitmapData = image.LockBits(area, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
                int stride = bitmapData.Stride;
                IntPtr ptr = bitmapData.Scan0;
                int numBytes = bitmapData.Stride * image.Height;
                byte[] rgbValues = new byte[numBytes];
                Marshal.Copy(ptr, rgbValues, 0, numBytes);
    

    And when you change them you should copy that array back to the Bitmap using this:

                Marshal.Copy(rgbValues, 0, bitmapData.Scan0, bitmapData.Stride * image.Height);
                image.UnlockBits(bitmapData);
    

    But if you realy want to deal with pixels like you said, you should use some FastBitmap implementation. There are many other implementations available also.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to learn mobile development for fun and as well to enrich
well i have a configuration like this in the components part of my config
I'm looking for a book about Xcode. I wonder which one might be good
I wonder to know if someone can help to understand if I'm doing well
On one free web-hosted place I build a site, well not actually a site,
I wonder if there is a way in crystal reports to do something like
There is one controversy I see in using Web APIs (RESTful service) to access
Possible Duplicate: Convert one date format into another in PHP I know there are
I have a Rails 3 simple scaffolded application having one model like that: class
I'm starting to wonder if this is even possible. I've searched for solutions on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.