예제 #1
0
        public void GetEncoder_Should_Get_Jpeg_Encoder()
        {
            // Arrange
            var target = new JpegSaver();

            // Act
            var result = target.GetEncoder();

            // Assert
            result.FormatID.Should().Be(ImageFormat.Jpeg.Guid);
        }
예제 #2
0
        public void GetFileExtensionTest()
        {
            // Arrange
            var target = new JpegSaver();

            // Act
            var result = target.GetFileExtension();

            // Assert
            result.Should().Be("*.JPG");
        }
예제 #3
0
        private void buttonStitch_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBoxImage1.Text) || string.IsNullOrWhiteSpace(textBoxImage2.Text) || string.IsNullOrWhiteSpace(textBoxOutPutImage.Text))
                return;

            var imageFile1 = new FileInfo(textBoxImage1.Text);
            var imageFile2 = new FileInfo(textBoxImage2.Text);
            var outputFile = new FileInfo(textBoxOutPutImage.Text);

            if (imageFile1.Exists && imageFile2.Exists)
            {
                var stitcher = new ImageStitcher(imageFile1, imageFile2);
                stitcher.Border = new SolidBorder(2, Color.Purple)
                                      {
                                          Inside = false
                                      };

                var outputImage = stitcher.DoStitch();

                var jpegSaver = new JpegSaver {ImageQuality = 85};
                jpegSaver.Save(outputImage, outputFile);
            }
        }