示例#1
0
        public static BitmapFrame Resize(this BitmapFrame frame, int percentage, BitmapScalingMode mode = BitmapScalingMode.NearestNeighbor)
        {
            if (frame.IsNullOrEmpty() || percentage <= 0)
            {
                return(null);
            }

            int width  = (int)((decimal)frame.Width).FindValueByPercentages(100, percentage);
            int height = (int)((decimal)frame.Height).FindValueByPercentages(100, percentage);

            return(frame.Resize(width, height, mode));
        }