0
                original = new Bitmap(this.Size.Width, this.Size.Height);
                Graphics gr = Graphics.FromImage(original);
                gr.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, original.Size);
                form1.getImage(original);

                original.Save("C:\\Users\\park\\Desktop\\test\\justest.jpeg", ImageFormat.Jpeg); // no error
                original.Save("C:\\Users\\park\\Desktop\\test\\justest.jpeg"+DateTime.Now.ToString("HH:mm")); // error

I tried Path.Combine() as well, but got the same error(path format is not supported).

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
eater Sun
  • 41
  • 4
  • 2
    Your attempted filename contains a colon, and that's not valid in a Windows file system. – Jon Skeet Mar 08 '23 at 19:25
  • As @JonSkeet said it the problem is colon in the file name (and there are some hack-arounds in suggested duplicate). For future questions please re-read the [mre] guidance on posting code as it additionally makes you to narrow down the problem to actual problem - i.e. in this case the fact you have an image is unrelated to the question, nor path to the file - as result single statement like `File.WriteAllText("a:b", text);` would be enough. Also make sure to include exact error as text in the future questions. – Alexei Levenkov Mar 08 '23 at 19:46

0 Answers0