Results 1 to 6 of 6

Thread: Qt ImageMagick "convert" fails

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Qt ImageMagick "convert" fails

    Hi,

    I'm using the code explained of the book "C++ GUI Programming with Qt4" chapter "Inter-Process Communication" that shows how to call ImageMagick "convert" application to convert an image file.
    I have changed the parameters to use a call like "convert -density 300 a.pdf a.bmp", so the args will be "-density" "300" "a.pdf" and "a.bmp".
    The output of QProcess tells that the parameter "300" is not valid.
    I've also tryied to use it like "convert -enhance a.pdf a.bmp" like the book example and I get a similar result "parameter a.pdf is not valid".

    Finally I want to tell that I used QProcess to call "identify -verbose a.pdf" and there is no problem and I can get the output of the process.

    Anyone had a similar problem?
    Thanks,

    P.D.:
    ImageMagick 6.7.3-8
    Qt 4.6.1
    Windows XP
    Òscar Llarch i Galán

  2. #2
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt ImageMagick "convert" fails

    Hi,

    Maybe you can specify the full path to the 'convert.exe' of imagemack, then you are sure that no other convert.exe is called.

    Do the commands work when you execute them on the command line ?

    The a.pdf file, is it in your project directory or in your .exe directory ? I believe the 'current directory' is the project directory, but I'm not 100% sure. When in doubt, I usually copy my test files everywhere to find out.

    Best regards,
    Marc

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt ImageMagick "convert" fails

    Hi,

    Maybe you can specify the full path to the 'convert.exe' of imagemack, then you are sure that no other convert.exe is called.
    "convert.exe" is called, so don't need to specify the full path. I is on the PATH environment variable.

    Do the commands work when you execute them on the command line ?
    The comands called on the coomand line work perfectly

    The a.pdf file, is it in your project directory or in your .exe directory ? I believe the 'current directory' is the project directory, but I'm not 100% sure. When in doubt, I usually copy my test files everywhere to find out.
    The file is located in the correct folder. Think on that "convert.exe" says that the parameter is not valid, not that it can't find the file.

    Thanks,


    Added after 6 minutes:


    Hi,

    It seems that I found what is happening.
    QProcess really calls "convert.exe" that is a Windows system application instead of "convert.exe" from ImageMagick.
    What I really don't understand is why QProcess don't use the same system environment variables that the command line have.
    Last edited by ^NyAw^; 19th December 2011 at 11:58.
    Òscar Llarch i Galán

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt ImageMagick "convert" fails

    QProcess really calls "convert.exe" that is a Windows system application instead of "convert.exe" from ImageMagick.
    What I really don't understand is why QProcess don't use the same system environment variables that the command line have.
    It almost certainly is using the same environment variables, but probably the Windows system directory is higher in priority on the system path than the ImageMagick directory. When you give an unqualified filename as a command line argument in a DOS window, it will search the current directory first for the matching exe; QProcess probably searches $PATH instead.

  5. #5
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt ImageMagick "convert" fails

    Hi,

    It almost certainly is using the same environment variables, but probably the Windows system directory is higher in priority on the system path than the ImageMagick directory. When you give an unqualified filename as a command line argument in a DOS window, it will search the current directory first for the matching exe; QProcess probably searches $PATH instead.
    The application directory does not contain ImageMagick exec files. ImageMagick is into "C:\Program Files\ImageMagick6.7.3-8" and PATH variable contains first the ImageMagick bin folder and then the "windows\system32" folder, so I think that firstly it will search on "C:\Program Files\ImageMagick6.7.3-8" folder(this is the normal behaviour on the command line console).

    Thanks,
    Òscar Llarch i Galán

  6. #6
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt ImageMagick "convert" fails

    QProcess really calls "convert.exe" that is a Windows system application instead of "convert.exe" from ImageMagick.
    Don't say I didn't tell you

Similar Threads

  1. Replies: 5
    Last Post: 9th August 2011, 12:18
  2. Replies: 11
    Last Post: 21st June 2011, 01:05
  3. Qt app for symbian which uses "QtWebKit" fails to launch
    By vijaydandur in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 2nd March 2011, 04:19
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. QPluginLoader fails when using "debug" config
    By paradiza in forum Qt Programming
    Replies: 22
    Last Post: 14th February 2007, 06:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.