ChangeSize() public static method

public static ChangeSize ( Bitmap bitmap, int newWidth, int newHeight, InterpolationMode interpolationMode = InterpolationMode.High ) : Bitmap
bitmap System.Drawing.Bitmap
newWidth int
newHeight int
interpolationMode InterpolationMode
return System.Drawing.Bitmap
        public OutputInfo Process()
        {
            LevelImage origLevelImage;

            LevelImage[] decLevelImages;

            var    image = _inputImage;
            double minDist = 0, maxDist = 0, avgDist = 0;

            for (int i = 0; i < IncLevelsCount; i++)
            {
                GenerateDecLevelsAndFragments(image, out origLevelImage, out decLevelImages);
                var mapping = SearchCorrespondingFragments(i, origLevelImage, decLevelImages);
                image = ReplaceFragments(origLevelImage, decLevelImages, mapping);

                double coef      = 1.0 + (ZoomCoef - 1) * (i + 1) / IncLevelsCount;
                int    newWidth  = (int)Math.Round(_inputImage.Width * coef);
                int    newHeight = (int)Math.Round(_inputImage.Height * coef);
                image = Utils.ChangeSize(image, newWidth, newHeight);

                var orderedByDistances = mapping.OrderBy(m => m.Distance);
                minDist = (minDist + orderedByDistances.First().Distance) / 2;
                maxDist = (maxDist + orderedByDistances.Last().Distance) / 2;
                avgDist = (avgDist + mapping.Average(m => m.Distance)) / 2;
            }

            return(new OutputInfo
            {
                Image = image,
                MinDistance = minDist,
                MaxDistance = maxDist,
                AvgDistance = avgDist
            });
        }
        private void GenerateDecLevelsAndFragments(Bitmap image,
                                                   out LevelImage origLevelImage, out LevelImage[] decLevelImages)
        {
            decLevelImages = new LevelImage[DecLevelsCount];

            origLevelImage = new LevelImage(image, Blur, BlurKernelSize, BlurSigma);
            double blockIncX = BlockIncRatioX * BlockWidth;

            if (blockIncX < 1)
            {
                blockIncX = 1;
            }
            double blockIncY = BlockIncRatioY * BlockHeight;

            if (blockIncY < 1)
            {
                blockIncY = 1;
            }
            origLevelImage.PrepareFragments(Blur, blockIncX, blockIncY, BlockWidth, BlockHeight);

            double decBlockIncX = DecBlockIncXRatio * BlockWidth;

            if (decBlockIncX < 1)
            {
                decBlockIncX = 1;
            }
            double decBlockIncY = DecBlockIncYRatio * BlockHeight;

            if (decBlockIncY < 1)
            {
                decBlockIncY = 1;
            }

            for (int i = 0; i < DecLevelsCount; i++)
            {
                double coef      = 1 / (Math.Pow(DecZoomCoef, (i + 1)));
                int    newWidth  = (int)Math.Round(image.Width * coef);
                int    newHeight = (int)Math.Round(image.Height * coef);
                image             = Utils.ChangeSize(image, newWidth, newHeight);
                decLevelImages[i] = new LevelImage(image, Blur, BlurKernelSize, BlurSigma);
                decLevelImages[i].PrepareFragments(Blur, decBlockIncX, decBlockIncY, BlockWidth, BlockHeight);
            }
        }
 public LevelImage(Bitmap bitmap, int newWidht, int newHeight, bool blur, int blurKernelSize, double blurSigma)
     : this(Utils.ChangeSize(bitmap, newWidht, newHeight), blur, blurKernelSize, blurSigma)
 {
 }