i finished writing c# algorithm that is applied on a '24 bit depth' bitmap image that i called from file, and it was success; but when i apply the algorithm on a 32 bit depth image a break while running occur which is : " Value does not fall within the expected range".

what i have to do in order to apply my code on this type of image "32bit".
i think i have to do something after the 'image.fromfile', to make it acceptable by the rest of the code.
plz reply me your suggestion!

when i add the bold statement, the result shown is a black image!, what i have to do??

private void button2_Click(object sender, System.EventArgs e)

        Image b = Image.FromFile(@"C:\project\test1.bmp" );

        Bitmap source =(Bitmap)b;
        [B]source = new Bitmap(320, 240, System.Drawing.Imaging.PixelFormat.Format24bppRgb);[/B]                        Gray(source);
        SobelEdgeDetector s= new SobelEdgeDetector();
        Bitmap k = s.Apply(source);
        g.DrawImage(k,5 ,5 );

re hi
any suggestion to convert the bitmap from 32 bit depth pixel to 24 bit (removing alpha)??
reply if you have an idea :o

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.