Exemplo n.º 1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            filePath = new FilePathSplitter(openFileDialog.FileName);

            saveFileDialog.Filter           = "jpeg (*.jpg)|*.jpg|png (*.png)|*.png) ";
            saveFileDialog.InitialDirectory = filePath.GetFileDirectory();
            saveFileDialog.FileName         = filePath.GetFileNameWithSuffix((string)editedImageBox.Image.Tag);

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                image.SaveImage((Bitmap)editedImageBox.Image, saveFileDialog.FileName);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string fileName = string.Empty;

            if (args.Length == 2)
            {
                fileName = args[1];
            }
            else if (args.Length == 1)
            {
                fileName = args[0];
            }
            else
            {
                Console.WriteLine("Enter a file path for an image: ");
                fileName = Console.ReadLine();
            }

            ImageEdit image = null;

            try
            {
                image = new ImageEdit(fileName);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid Format");
                Environment.Exit(1);
            }

            Bitmap blurredImage   = image.CreateBlurredImage();
            Bitmap greyscaleImage = image.CreateGrayscaleImage();
            Bitmap negativeImage  = image.CreateNegativeImage();

            image.SaveImage(blurredImage);
            image.SaveImage(greyscaleImage);
            image.SaveImage(negativeImage);
        }