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

  • SEARCH
  • Home
  • 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 5939859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:53:15+00:00 2026-05-22T15:53:15+00:00

Hi i have a bmp loaded to a BMP object and im required to

  • 0

enter image description here

Hi i have a bmp loaded to a BMP object and im required to travel though the pixels as the above image from (1,1) pixel to (100,100) px . using getpixel() method. I was using was ONE loop but it was not successful .

If im using the concept of multidimensional array what should be variable values ?

  • 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-05-22T15:53:16+00:00Added an answer on May 22, 2026 at 3:53 pm

    When you want to doing image processing
    on huge images GetPixel() method takes long time
    but I think my algorithm takes less
    time than other answers , for example
    you can test this code on 800 * 600
    pixels image.


    Bitmap bmp = new Bitmap("SomeImage");
    
    // Lock the bitmap's bits.  
    Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
    BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
    
    // Get the address of the first line.
    IntPtr ptr = bmpData.Scan0;
    
    // Declare an array to hold the bytes of the bitmap.
    int bytes = bmpData.Stride * bmp.Height;
    byte[] rgbValues = new byte[bytes];
    byte[] r = new byte[bytes / 3];
    byte[] g = new byte[bytes / 3];
    byte[] b = new byte[bytes / 3];
    
    // Copy the RGB values into the array.
    Marshal.Copy(ptr, rgbValues, 0, bytes);
    
    int count = 0;
    int stride = bmpData.Stride;
    
    for (int column = 0; column < bmpData.Height; column++)
    {
        for (int row = 0; row < bmpData.Width; row++)
        {
            b[count] = (byte)(rgbValues[(column * stride) + (row * 3)]);
            g[count] = (byte)(rgbValues[(column * stride) + (row * 3) + 1]);
            r[count++] = (byte)(rgbValues[(column * stride) + (row * 3) + 2]);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Image Dummy = Image.FromFile(image.png); Dummy.Save(image.bmp, ImageFormat.Bmp); what the question says i have these using
I have a .bmp image. I wanted to encrypt the image file using openssl
I have a WriteableBitmap which loads the bitmap image from file(mostly bmp). The bitmap
I'm using the EasyBMP library. I have a function that returns a BMP* object.
I have a BMP image and I wish to convert it into a Bitmap
I have an array of bytes representing an image in Windows BMP format and
How can i compress and image file(*bmp,*jpeg) in C#, I have to display some
I have a bmp image link, this image I would like to save in
I have this function to store the bmp image in a desired location as
I have an image of type '.bmp' (NOT jpeg or png). I am trying

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.