Exemple #1
0
        public Image Resize(double scale, ResamplingFilters technique)
        {
            FluxJpeg.Core.Filtering.Filter filter;
            int newHeight = (int)(scale * this._input.Height);
            int newWidth  = (int)(scale * this._input.Width);

            switch (technique)
            {
            case ResamplingFilters.NearestNeighbor:
                filter = new NNResize();
                break;

            case ResamplingFilters.LowpassAntiAlias:
                filter = new LowpassResize();
                break;

            default:
                throw new NotSupportedException();
            }
            return(new Image(this._input.ColorModel, filter.Apply(this._input.Raster, newWidth, newHeight)));
        }
        public Image Resize(double scale, ResamplingFilters technique)
        {
            int height = (int)(scale * _input.Height);
            int width  = (int)(scale * _input.Width);

            Filter resizeFilter;

            switch (technique)
            {
            case ResamplingFilters.NearestNeighbor:
                resizeFilter = new NNResize();
                break;

            case ResamplingFilters.LowpassAntiAlias:
                resizeFilter = new LowpassResize();
                break;

            default:
                throw new NotSupportedException();
            }

            return(new Image(_input.ColorModel, resizeFilter.Apply(_input.Raster, width, height)));
        }