示例#1
0
        static void Main(string[] args)
        {
            var image = ImageManager.GetSampleImage();

            var imageScaler = new ImageScaler();
            var scaledImage = imageScaler.ScaleTo(image, 10, InterpolationMethod.NearestNeighbour);

            ImageManager.SaveImage(scaledImage, Assembly.GetExecutingAssembly());
        }
示例#2
0
        private static Image <Rgba32> ZoomImage(Image <Rgba32> image, float zoom, int xMin, int xMax, int yMin, int yMax)
        {
            var newImg = new Image <Rgba32>(xMax - xMin, yMax - yMin);

            for (var y = yMin; y < yMax; ++y)
            {
                for (var x = xMin; x < xMax; ++x)
                {
                    var newY = y - yMin;
                    var newX = x - xMin;

                    newImg[newX, newY] = image[x, y];
                }
            }

            var imageScaler = new ImageScaler();

            return(imageScaler.ScaleTo(newImg, zoom, InterpolationMethod.Billinear));
        }