Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Command Line Arguments For IrfanView using C# WinForm

Command Line Arguments For IrfanView using C# WinForm

Scheduled Pinned Locked Moved C#
csharphelpquestion
6 Posts 3 Posters 40 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_14354214
    wrote on last edited by
    #1

    I have tried to pass command line arguments to IrfanView to rotate a image, the code is below, the commented code works without a problem. The problem is the uncommented code, when the process is started, there are no errors but no changes are made to the image. I have tried the proper syntax code in VB.NET and it works as expected, any insight as to what's wrong? //args = file1 + " " + "/rotate_r " + "/convert=" + file2 + "/killmesoftly"; //args = " " + file1 + " " + "/rotate_r " + "/jpgq=100" + "/convert=" + file2 + "/killmesoftly"; args = " " + file1 + " " + "/jpg_rotate=(3,1,0,1,0,0,0,0)" + "/killmesoftly";

    D P 2 Replies Last reply
    0
    • M Member_14354214

      I have tried to pass command line arguments to IrfanView to rotate a image, the code is below, the commented code works without a problem. The problem is the uncommented code, when the process is started, there are no errors but no changes are made to the image. I have tried the proper syntax code in VB.NET and it works as expected, any insight as to what's wrong? //args = file1 + " " + "/rotate_r " + "/convert=" + file2 + "/killmesoftly"; //args = " " + file1 + " " + "/rotate_r " + "/jpgq=100" + "/convert=" + file2 + "/killmesoftly"; args = " " + file1 + " " + "/jpg_rotate=(3,1,0,1,0,0,0,0)" + "/killmesoftly";

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      I don't know why newbs always insist on breaking up what should be a single string into a bunch of string concatenations, making it harder to debug your code. You can do this all in one string:

      args = $"{file1} /jpg_rotate=(3,1,0,1,0,0,0,0) /killmesoftly";

      Take a closer look at your uncommented code:

      args = " " + file1 + " " + "/jpg_rotate=(3,1,0,1,0,0,0,0)" + "/killmesoftly";

      This will result in an arguments string that looks like this:

      [file1] //jpg_rotate=(3,1,0,1,0,0,0,0)/killmesoftly

      Notice there is no space before the /killmosoftly switch. That will probably generate an error for the Irfan command.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

      M 1 Reply Last reply
      0
      • M Member_14354214

        I have tried to pass command line arguments to IrfanView to rotate a image, the code is below, the commented code works without a problem. The problem is the uncommented code, when the process is started, there are no errors but no changes are made to the image. I have tried the proper syntax code in VB.NET and it works as expected, any insight as to what's wrong? //args = file1 + " " + "/rotate_r " + "/convert=" + file2 + "/killmesoftly"; //args = " " + file1 + " " + "/rotate_r " + "/jpgq=100" + "/convert=" + file2 + "/killmesoftly"; args = " " + file1 + " " + "/jpg_rotate=(3,1,0,1,0,0,0,0)" + "/killmesoftly";

        P Offline
        P Offline
        Peter_in_2780
        wrote on last edited by
        #3

        Adding to Dave's wise words, your uncommented string doesn't specify an output file, so it may very well execute the process and discard the result.

        Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

        M 1 Reply Last reply
        0
        • D Dave Kreskowiak

          I don't know why newbs always insist on breaking up what should be a single string into a bunch of string concatenations, making it harder to debug your code. You can do this all in one string:

          args = $"{file1} /jpg_rotate=(3,1,0,1,0,0,0,0) /killmesoftly";

          Take a closer look at your uncommented code:

          args = " " + file1 + " " + "/jpg_rotate=(3,1,0,1,0,0,0,0)" + "/killmesoftly";

          This will result in an arguments string that looks like this:

          [file1] //jpg_rotate=(3,1,0,1,0,0,0,0)/killmesoftly

          Notice there is no space before the /killmosoftly switch. That will probably generate an error for the Irfan command.

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

          M Offline
          M Offline
          Member_14354214
          wrote on last edited by
          #4

          Dave; Thank you for responding, unfortunately the image was not rotated. As I stated previously the string works in Excel VBA & VB.NET with the correct file location syntax. Thanks again for your help

          D 1 Reply Last reply
          0
          • P Peter_in_2780

            Adding to Dave's wise words, your uncommented string doesn't specify an output file, so it may very well execute the process and discard the result.

            Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

            M Offline
            M Offline
            Member_14354214
            wrote on last edited by
            #5

            Peter; Thank you for responding. There is no switch for an output file, because the original file is overwritten.

            1 Reply Last reply
            0
            • M Member_14354214

              Dave; Thank you for responding, unfortunately the image was not rotated. As I stated previously the string works in Excel VBA & VB.NET with the correct file location syntax. Thanks again for your help

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              I didn't say I knew anything about Irfan, only that your code is unnecessarily complicated, making it harder to debug.

              Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups