Affecto.PositiveFeedback.EmployeeSynchronization.ActiveDirectory.EmployeePicture.LocalPicture.Crop C# (CSharp) Method

Crop() private static method

private static Crop ( Image image, int newWidth, int newHeight ) : Image
image Image
newWidth int
newHeight int
return Image
        private static Image Crop(Image image, int newWidth, int newHeight)
        {
            int x = 0;

            if (image.Width > newWidth)
            {
                int excessWidth = image.Width - newWidth;
                x = excessWidth / 2;
            }

            return image.Crop(newWidth, newHeight, x);
        }
    }