본문 바로가기

컴퓨터 과학 & 영상처리 관련/C# / .NET / JAVA

c# bitmap interpolation

http://stackoverflow.com/questions/2666351/bitmap-interpolation-c-sharp

 

 

        public Image EnlargeImage(Image original, int width, int height)
        {
            Bitmap newimg = new Bitmap(width, height);

            using (Graphics g = Graphics.FromImage(newimg))
            {
                // Here you set your interpolation mode
                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;

                // Scale the image, by drawing it on the larger bitmap
                g.DrawImage(original, new Rectangle(Point.Empty, newimg.Size));
            }

            return newimg;
        }

Bitmap img = (Bitmap)EnlargeImage(bt, pictureBox_ori.Width, pictureBox_ori.Height);