예제 #1
0
        public void TestWithExtraWidthThatMakesLeftNegative()
        {
            var imageFolder = string.Format(@"{0}\{1}", ExecutionDirInfoHelper.GetInputDirPath(), "testcropping_disc_very_left_of_image");

            var clickInputs = MainProcessor.GetClickInputsFromFile(imageFolder + @"\ClickInputs.xml");

            var imagePath = string.Format(@"{0}\{1}", imageFolder, clickInputs.ImageClickInputDetailsList[0].ImageName);

            _image = (Bitmap)Image.FromFile(imagePath);

            var imageAlterationParams = new ImageAlterationParams
            {
                MinImageHeightRatio  = 0.7,
                PercentExtraWidth    = 10,
                InvalidColor         = _bkColor,
                BottomPaddingPercent = 0
            };
            var croppedImg = ImageCropper.GetCroppedImage(clickInputs.ImageClickInputDetailsList[0], _image, imageAlterationParams);

            var outputPath = string.Format(@"{0}\cropped_with_extra_beyond_left.jpg", _outputFolder);

            croppedImg.Save(outputPath);
        }