Bitmap Save method gives "Parameter is not valid"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Sm9hY2hpbQ==?=

    Bitmap Save method gives "Parameter is not valid"

    I have an image which I'm trying to save using

    my_image.Save(s ome_path, System.Drawing. Imaging.ImageFo rmat.Path);

    and then I get the error "Parameter is not valid".
    What could be the reason for this error? I know I can store it as a Png file.
  • DeveloperX

    #2
    Re: Bitmap Save method gives "Parame ter is not valid"

    On 31 Jul, 10:58, Joachim <Joac...@discus sions.microsoft .comwrote:
    I have an image which I'm trying to save using
    >
    my_image.Save(s ome_path, System.Drawing. Imaging.ImageFo rmat.Path);
    >
    and then I get the error "Parameter is not valid".
    What could be the reason for this error? I know I can store it as a Png file.
    ImageFormat.Pat h doesn't exist as far as I can see. Try changing it to
    Jpeg just to test. What format do you want to save it as?

    Comment

    • =?Utf-8?B?Sm9hY2hpbQ==?=

      #3
      Re: Bitmap Save method gives &quot;Parame ter is not valid&quot;

      Sorry, I wrote wrong. It should be Png

      "DeveloperX " wrote:
      On 31 Jul, 10:58, Joachim <Joac...@discus sions.microsoft .comwrote:
      I have an image which I'm trying to save using

      my_image.Save(s ome_path, System.Drawing. Imaging.ImageFo rmat.Path);

      and then I get the error "Parameter is not valid".
      What could be the reason for this error? I know I can store it as a Png file.
      >
      ImageFormat.Pat h doesn't exist as far as I can see. Try changing it to
      Jpeg just to test. What format do you want to save it as?
      >
      >

      Comment

      • =?UTF-8?B?R8O2cmFuIEFuZGVyc3Nvbg==?=

        #4
        Re: Bitmap Save method gives &quot;Parame ter is not valid&quot;

        Joachim wrote:
        Sorry, I wrote wrong. It should be Png
        >
        "DeveloperX " wrote:
        >
        >On 31 Jul, 10:58, Joachim <Joac...@discus sions.microsoft .comwrote:
        >>I have an image which I'm trying to save using
        >>>
        >>my_image.Save (some_path, System.Drawing. Imaging.ImageFo rmat.Path);
        >>>
        >>and then I get the error "Parameter is not valid".
        >>What could be the reason for this error? I know I can store it as a Png file.
        >ImageFormat.Pa th doesn't exist as far as I can see. Try changing it to
        >Jpeg just to test. What format do you want to save it as?
        >>
        >>
        Then there's only one parameter left that can be invalid.

        What does some_path contain?

        --
        Göran Andersson
        _____
        Göran Anderssons privata hemsida.

        Comment

        • =?Utf-8?B?Sm9hY2hpbQ==?=

          #5
          Re: Bitmap Save method gives &quot;Parame ter is not valid&quot;

          An existing path, including file name (which does not exist).

          "Göran Andersson" wrote:
          Joachim wrote:
          Sorry, I wrote wrong. It should be Png

          "DeveloperX " wrote:
          On 31 Jul, 10:58, Joachim <Joac...@discus sions.microsoft .comwrote:
          >I have an image which I'm trying to save using
          >>
          >my_image.Save( some_path, System.Drawing. Imaging.ImageFo rmat.Path);
          >>
          >and then I get the error "Parameter is not valid".
          >What could be the reason for this error? I know I can store it as a Png file.
          ImageFormat.Pat h doesn't exist as far as I can see. Try changing it to
          Jpeg just to test. What format do you want to save it as?
          >
          >
          >
          Then there's only one parameter left that can be invalid.
          >
          What does some_path contain?
          >
          --
          Göran Andersson
          _____
          Göran Anderssons privata hemsida.

          >

          Comment

          • DeveloperX

            #6
            Re: Bitmap Save method gives &quot;Parame ter is not valid&quot;

            On 31 Jul, 12:04, Joachim <Joac...@discus sions.microsoft .comwrote:
            An existing path, including file name (which does not exist).
            >
            >
            >
            "Göran Andersson" wrote:
            Joachim wrote:
            Sorry, I wrote wrong. It should be Png
            >
            "DeveloperX " wrote:
            >
            >On 31 Jul, 10:58, Joachim <Joac...@discus sions.microsoft .comwrote:
            >>I have an image which I'm trying to save using
            >
            >>my_image.Save (some_path, System.Drawing. Imaging.ImageFo rmat.Path);
            >
            >>and then I get the error "Parameter is not valid".
            >>What could be the reason for this error? I know I can store it as aPng file.
            >ImageFormat.Pa th doesn't exist as far as I can see. Try changing it to
            >Jpeg just to test. What format do you want to save it as?
            >
            Then there's only one parameter left that can be invalid.
            >
            What does some_path contain?
            >
            --
            Göran Andersson
            _____
            http://www.guffa.com- Hide quoted text -
            >
            - Show quoted text -
            Check what the string holds. If you've got something like

            string some_path = "C:\pics\whatev er";
            that will actually turn the \p and \w into escape codes (if they're
            valid ones)

            so use the @ like so:
            string some_path = @"C:\pics\whate ver";

            if you've got my_image.Save(" C:\mypath",
            System.Drawing. Imaging.ImageFo rmat.Png);
            again just put an @ at the start.
            my_image.Save(@ "C:\mypath" , System.Drawing. Imaging.ImageFo rmat.Png);


            Comment

            • =?Utf-8?B?Sm9hY2hpbQ==?=

              #7
              Re: Bitmap Save method gives &quot;Parame ter is not valid&quot;

              I've got double backslash (\\).

              "DeveloperX " wrote:
              On 31 Jul, 12:04, Joachim <Joac...@discus sions.microsoft .comwrote:
              An existing path, including file name (which does not exist).



              "Gvran Andersson" wrote:
              Joachim wrote:
              Sorry, I wrote wrong. It should be Png
              "DeveloperX " wrote:
              On 31 Jul, 10:58, Joachim <Joac...@discus sions.microsoft .comwrote:
              >I have an image which I'm trying to save using
              >my_image.Save( some_path, System.Drawing. Imaging.ImageFo rmat.Path);
              >and then I get the error "Parameter is not valid".
              >What could be the reason for this error? I know I can store it as a Png file.
              ImageFormat.Pat h doesn't exist as far as I can see. Try changing it to
              Jpeg just to test. What format do you want to save it as?
              Then there's only one parameter left that can be invalid.
              What does some_path contain?
              --
              Gvran Andersson
              _____
              >http://www.guffa.com- Hide quoted text -
              - Show quoted text -
              >
              Check what the string holds. If you've got something like
              >
              string some_path = "C:\pics\whatev er";
              that will actually turn the \p and \w into escape codes (if they're
              valid ones)
              >
              so use the @ like so:
              string some_path = @"C:\pics\whate ver";
              >
              if you've got my_image.Save(" C:\mypath",
              System.Drawing. Imaging.ImageFo rmat.Png);
              again just put an @ at the start.
              my_image.Save(@ "C:\mypath" , System.Drawing. Imaging.ImageFo rmat.Png);
              >
              >
              >

              Comment

              • Robert

                #8
                Re: Bitmap Save method gives &quot;Parame ter is not valid&quot;

                I'm having the same problem...my path is correct, and the ImageFormat is correct. But it continues to give me the same error "Parameter is not valid"

                If you figured the solution out, please post, I'll continue to look around.

                Comment

                Working...