Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Process with arguments doesn't work...
Qt 6.11 is out! See what's new in the release blog

Process with arguments doesn't work...

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 3 Posters 2.1k Views 2 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.
  • G Offline
    G Offline
    Gerd
    wrote on last edited by
    #5

    Think you are missing a "/" after

    mrjjM 1 Reply Last reply
    2
    • G Gerd

      Think you are missing a "/" after

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #6

      @Gerd
      Good catch!
      yes seems filename will be directly appended.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gerd
        wrote on last edited by
        #7

        Sorry, last post was incomplete...
        Think you are missing a "/" after "Messages" and before filename in this Line:

        arguments << "convert -density 300 -trim" <<"//DGS1109N007/Affichage/Messages"+filename<<"-quality 100 "<<"//DGS1109N007/Affichage/Display/Messages/output.jpg"
        
        F 1 Reply Last reply
        1
        • mrjjM mrjj

          @filipdns
          but what did it report ?
          Its impossible to guess what is wrong with no extra info.
          and that function is how QProcess tells how it went.

          btw. i can see
          magick.exe so that seems like windows.
          but you are giving it linux paths as parameter
          "//DGS1109N007/Affichage/Messages"

          windows uses \ and not / so not sure magick.exe likes it.
          also in your sample for .bat, you are using the \ version.

          F Offline
          F Offline
          filipdns
          wrote on last edited by
          #8

          @mrjj You are right, magick don't like / but qt don't like \ then, I don't know...

          1 Reply Last reply
          0
          • G Gerd

            Sorry, last post was incomplete...
            Think you are missing a "/" after "Messages" and before filename in this Line:

            arguments << "convert -density 300 -trim" <<"//DGS1109N007/Affichage/Messages"+filename<<"-quality 100 "<<"//DGS1109N007/Affichage/Display/Messages/output.jpg"
            
            F Offline
            F Offline
            filipdns
            wrote on last edited by
            #9

            @Gerd Hi Gerd, Yes, the / was missing, now I receive something, but error and not expected conversion...

            magick.exe: UnableToOpenBlob 'convert -density 300 -trim': No such file or directory @ error/blob.c/OpenBlob/3490.

            what mean what say mrjj, magick don't accept / but expect ...

            I will try replace.("/", "\") to see what append..

            1 Reply Last reply
            0
            • G Offline
              G Offline
              Gerd
              wrote on last edited by
              #10

              try to check what is in arguments, it seems that you also miss a blnk after "...trim"

              F 1 Reply Last reply
              0
              • G Gerd

                try to check what is in arguments, it seems that you also miss a blnk after "...trim"

                F Offline
                F Offline
                filipdns
                wrote on last edited by
                #11

                @Gerd Hi Gerd,

                I found how make it work:

                program=QDir::toNativeSeparators("//DGS1109N007/Echanges_SAA/Affichage/Display/imagmagick/magick ")+ "convert -density 300 -trim "+ QDir::toNativeSeparators("\"//DGS1109N007/Echanges_SAA/Affichage/Messages/"+filename)+"\" -quality 100 "+QDir::toNativeSeparators("\"//DGS1109N007/Echanges_SAA/Affichage/Display/Messages/output.jpg");
                

                now I have an other strange thing not linked with this topic...

                with:

                QDir directory("//DGS1109N007/Echanges_SAA/Affichage/Messages");
                    QStringList images = directory.entryList(QStringList(),QDir::Files);
                
                    for(int i=0;i<images.count();i++) {
                    //do whatever you need to do
                    QString filename=images[i];
                    qDebug()<<"filename"<<filename;
                
                    program=QDir::toNativeSeparators("//DGS1109N007/Echanges_SAA/Affichage/Display/imagmagick/magick ")+ "convert -density 300 -trim "+ QDir::toNativeSeparators("\"//DGS1109N007/Echanges_SAA/Affichage/Messages/"+filename)+"\" -quality 100 "+QDir::toNativeSeparators("\"//DGS1109N007/Echanges_SAA/Affichage/Display/Messages/output.jpg");
                    myProcess.start(program);
                    myProcess.waitForFinished(10000);
                   
                    }
                

                the conersion is made only with the first file, but the qDebug()<<"filename"<<filename; print all files...

                I try to put some waitForFinished but same result...

                mrjjM 1 Reply Last reply
                0
                • F filipdns

                  @Gerd Hi Gerd,

                  I found how make it work:

                  program=QDir::toNativeSeparators("//DGS1109N007/Echanges_SAA/Affichage/Display/imagmagick/magick ")+ "convert -density 300 -trim "+ QDir::toNativeSeparators("\"//DGS1109N007/Echanges_SAA/Affichage/Messages/"+filename)+"\" -quality 100 "+QDir::toNativeSeparators("\"//DGS1109N007/Echanges_SAA/Affichage/Display/Messages/output.jpg");
                  

                  now I have an other strange thing not linked with this topic...

                  with:

                  QDir directory("//DGS1109N007/Echanges_SAA/Affichage/Messages");
                      QStringList images = directory.entryList(QStringList(),QDir::Files);
                  
                      for(int i=0;i<images.count();i++) {
                      //do whatever you need to do
                      QString filename=images[i];
                      qDebug()<<"filename"<<filename;
                  
                      program=QDir::toNativeSeparators("//DGS1109N007/Echanges_SAA/Affichage/Display/imagmagick/magick ")+ "convert -density 300 -trim "+ QDir::toNativeSeparators("\"//DGS1109N007/Echanges_SAA/Affichage/Messages/"+filename)+"\" -quality 100 "+QDir::toNativeSeparators("\"//DGS1109N007/Echanges_SAA/Affichage/Display/Messages/output.jpg");
                      myProcess.start(program);
                      myProcess.waitForFinished(10000);
                     
                      }
                  

                  the conersion is made only with the first file, but the qDebug()<<"filename"<<filename; print all files...

                  I try to put some waitForFinished but same result...

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  @filipdns
                  Hi
                  but dont you save all input files to the same filename (output.jpg) ?

                  F 2 Replies Last reply
                  0
                  • mrjjM mrjj

                    @filipdns
                    Hi
                    but dont you save all input files to the same filename (output.jpg) ?

                    F Offline
                    F Offline
                    filipdns
                    wrote on last edited by
                    #13

                    @mrjj hi, not, imagemagic rename output file itself like ouput-1.jpg output-2.jpg

                    1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @filipdns
                      Hi
                      but dont you save all input files to the same filename (output.jpg) ?

                      F Offline
                      F Offline
                      filipdns
                      wrote on last edited by
                      #14

                      @mrjj I openned an other topic for this problem because it's not linked with the title ;-)

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved