convert image file to 24bpp bmp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrcw
    New Member
    • Nov 2008
    • 82

    convert image file to 24bpp bmp

    Hi

    I'm trying to save a webcam image to a 24 bpp bmp using

    pictureBox1.Ima ge.Save("c:/users/Mark/Desktop/pictureBox1.Bmp ", System.Drawing. Imaging.ImageFo rmat.Bmp);

    but I keep on getting the wrong format. Any ideas what I'm doing wrong

    thnx

    mrcw
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Try picking the specific bitmap type you want.
    Somewhere you can set PixelFormat.For mat24bppRgb

    Comment

    • mrcw
      New Member
      • Nov 2008
      • 82

      #3
      I think I am making a new 24bpp bmp that is the right size and format. But the bmp is black or empty. How do I assign or put the image into the bmp?
      [code=C#]
      private void button1_Click(o bject sender, EventArgs e)
      {
      //Loads image from disk puts it into picturebox1
      pictureBox1.Ima ge = Image.FromFile( "c:/users/Mark/Desktop/pictureBox1.Ima ge");

      //copys image from picturebox1 to picturebox2
      pictureBox2.Ima ge = pictureBox1.Ima ge;

      //pictureBox2.Ima ge = new Bitmap(pictureB ox2.Width, pictureBox2.Hei ght, System.Drawing. Imaging.PixelFo rmat.Format24bp pRgb);

      // declares new bitmap called pic
      Bitmap pic;

      //makes pic bitmap same size as picturebox1.ima ge
      pic = new Bitmap(pictureB ox1.Width, pictureBox1.Hei ght, System.Drawing. Imaging.PixelFo rmat.Format24bp pRgb);

      //Finds edges of pic
      ReplaceImage(Ed geFinder((Bitma p)pic));

      mrcw

      }[/code]

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Create a Graphics object from your new bitmap, then use the DrawImage functions to put the bitmap onto it.

        Comment

        Working...