Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have got a problem regarding Bitmap file. To read the bitmap (256x256) file I use two dimensional array by scrip the header.
C#
for (x =0; x <256; x++)
{
   for (y =0; y<256; y++)
   {
       c1.ori_mat[x, y] = (byte)image1.ReadByte();
   }
}


Now after doing something on the ori_mat array (not reverse or other thing, just something with value), I want to show the image on a picture box using setpixel() function.

C#
Bitmap img = new Bitmap(256, 256);
for (int i = 0; i < 256; i++)
     for (int j =0; j<256; j++)
     {
        img.SetPixel(i,j, Color.FromArgb(c1.ori_mat[i, j], c1.ori_mat[i, j],c1.ori_mat[i,j]));
      }
      pictureBox1.Image= img;


But the image is shown in the picture box is reverse or mirrored (not the same as original picture).

Can someone please whats my problem. Thanks in advance.
Take care and bye.
Posted

1 solution

The Bitmap class has a RotateFlip method which may be of use to you (see the Help system for details) although I have to say that your whole methodology seems a little complicated.

There may of course be a perfectly valid reason for this but if you were to explain what it is that you are trying to do, someone might be able to suggest a more efficient way of achieving your aims.

Good luck. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900