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 6713723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:24:49+00:00 2026-05-26T08:24:49+00:00

Sorry I had no idea how set a topic which could express what help

  • 0

Sorry I had no idea how set a topic which could express what help I need.

I have in an array of bytes, values for each pixel from a bitmap. It is a one dimensional array, from left to right. It takes each row and add it to the end of array’s index.

I would like to split a bitmap to 225(=15*15) pieces. Each brick has for example dimension 34×34 and the length of array is then 260100(=225*34*34). So as you see now we will need 15 bricks on width and on height.

Few months ago I was using two loops starting from 0 – 14. I wrote own long code to get all that 34×34 bricks. However I didn’t used any array which was storing all values.

Now I have a one dimensional array because marshal copy and bitmapdata with bitlocks were the best way to fast copy all pixels’ values to array.

But I stand face to face with problem how to get 34 elements then one row lower and another one knowing that on 35 level will be another brick with its own starting value..

PS. edit my post if something is not good.

Few people could say “first make any your test code”. I tried that but what I got was just trash and I really don’t know how to do that.


This method was used to crop image to smaller images containing bricks. But I don’t want store small images of brick. I need values storing in array of bytes.

Under, there is a proof.

private void OCropImage(int ii, int jj, int p, int p2)


   {
        ////We took letter and save value to binnary, then we search in dictionary by value
        this.rect = new Rectangle();
        this.newBitmap = new Bitmap(this.bitmap);
        for (ii = 0; ii < p; ii++)
        {
            for (jj = 0; jj < p2; jj++)
            {
                ////New bitmap
                this.newBitmap = new Bitmap(this.bitmap);

                ////Set rectangle working area with letters
                this.rect = new Rectangle(jj * this.miniszerokosc, ii * this.miniwysokosc, this.miniszerokosc, this.miniwysokosc);
                ////Cut single rectangle with letter
                this.newBitmap = this.newBitmap.Clone(this.rect, this.newBitmap.PixelFormat);
                ////Add frame to rectangle to delet bad noise
                this.OAddFrameToCropImage(this.newBitmap, this.rect.Width, this.rect.Height);
                this.frm1.SetIm3 = (System.Drawing.Image)this.newBitmap;

                ////Create image with letter which constains less background
                this.newBitmap = this.newBitmap.Clone(this.GetAreaLetter(this.newBitmap), this.newBitmap.PixelFormat);
                ////Count pixels in bitmap
                this.workingArea = this.GetBinnary(this.newBitmap);

                var keysWithMatchingValues = this.alphabetLetters.Where(x => x.Value == this.workingArea).Select(x => x.Key);
                foreach (var key in keysWithMatchingValues)
                {
                    this.chesswords += key.ToString();
                }
            }

            this.chesswords += Environment.NewLine;
            var ordered = this.alphabetLetters.OrderBy(x => x.Value);
        }
    }

PS2. sorry for my English, please correct it if it is needed.

  • 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-26T08:24:50+00:00Added an answer on May 26, 2026 at 8:24 am

    If I get you right, then if you have an image like this

    p00|p01|p02|...
    ---+---+-------
    p10|p11|p12|...
    ---+---+-------
    p20|p21|p22|...
    ---+---+---+---
    ...|...|...|...
    

    Which is stored in an array in left-to-right row scan like this:

    p00,p01,...,p0n, p10,p11,...,p1n, p20,p21, ...
    

    If I understand you correctly, what you want to be able to do, is to take a given rectangle (from a certain x and y with a certain width and height) from the image. Here is code to do this, with explanations:

    byte[] crop_area (byte[] source_image, int image_width, int image_height,
    int start_x, int start_y, int result_width, int result_height)
    {
        byte[] result = new byte[result_width * result_height];
        int endX = x + result_width;
        int endY = y + result_height;
    
        int pos = 0;
    
        for (int y = startY; y < endY; y++)
            for (int x = startX; x < endX; x++)
            {
                /* To get to the pixel in the row I (starting from I=1), we need
                 * to skip I-1 rows. Since our y indexes start from row 0 (not 1),
                 * then we don't need to subtract 1.
                 *
                 * So, the offset of the pixel at (x,y) is:
                 *
                 *     y * image_width      +        x
                 * |-----------------------| |-----------------|
                 *   Skip pixels of y rows    Offset inside row
                 */
                result[pos] = source_image[y * image_width + x];
    
                /* Advance to the next pixel in the result image */
                pos++;
            }
        return result;
    }
    

    Then, to take the block in the row I and column J (I,J=0,…,14) do:

    crop_area (source_image, image_width, image_height, J*image_width/15, I*image_height/15, image_width/15, image_height/15)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry the title isn't more help. I have a database of media-file URLs that
Sorry if I repeat my question but I have still had no clues of
im sorry if this has already been covered, i have had a look but
Sorry about the non-descriptive title; Had no Idea how to put it. So when
Here is the situation: I have a huge data set that I need quick
Sorry for such a lame title, but I just had no idea what to
Sorry I had to rephrase my question, I have a list preference with some
Sorry for asking silly question.. I have an array with class objects like: Class
I'm sorry for opening a new question, I had to - as I wrote
If this was previously talked about, I'm sorry, I had a hard time searching

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.