kdcorp87 4 Junior Poster in Training

my job is
1.maximize
2.smoothing

when i just write maximize part and ran it work fine for 550-600 pixel
and
when i just write smoothing part and ran it work fine for 5500-6000 pixel.

but when i attached both code failed at maximizing point. i want to know why and how to solve it. plz help me.
specially from Rysad an addapost plz look the code, i m sure u guys could fins a way as before.

private void button2_Click(object sender, EventArgs e)
        {
            if (!flag)
            { MessageBox.Show("PLEASE SELECT A VALID IMAGE", "IMAGE LOAD PROBLEM"); }
            else
            { 
             //image maximizing

                System.Drawing.Image image1 = pictureBox1.Image;

                int sourceWidth = image1.Width;
                int sourceHeight = image1.Height;

              
                
              

                int destWidth = (int)(sourceWidth *10);
                int destHeight = (int)(sourceHeight *10);

                Bitmap b = new Bitmap(destWidth, destHeight);
                toolStripProgressBar1.Value = 15;
                Graphics g = Graphics.FromImage((System.Drawing.Image)b);
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                toolStripProgressBar1.Value = 40;
                toolStripStatusLabel1.Text = "IMAGE MAXIMIZING";
                g.DrawImage(image1, 0, 0, destWidth, destHeight);
                toolStripProgressBar1.Value = 65;
                toolStripStatusLabel1.Text = "IMAGE MAXIMIZED";
                g.Dispose();
                image1.Dispose();

                //smoothing 
                smoohting(b);
            
            }
            
        }
        private void smoohting(Bitmap b)
        {
            toolStripProgressBar1.Value = 90;
            AForge.Imaging.Filters.OilPainting filter = new AForge.Imaging.Filters.OilPainting(14);
            Bitmap a = filter.Apply(b);

            b.Dispose();
           a.Save("D:\\ax.gif");

            toolStripProgressBar1.Value = 100;
          
        }
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.