mateuszzz88
3rd July 2011, 21:02
Hello,
I'm trying to use ImageMagick with QProcess under Linux. The arguments are quite complicated, the whole command needed is for example:
convert /tmp/temporaryPicture20.png -matte -virtual-pixel transparent -define distort:viewport=1105x3241+4572829+2684426 -distort Perspective '592,154 4572830,2684542 1408,54 4573934,2684426 654,2432 4572942,2687666 ' +repage /tmp/temporaryPicture20_out.png
Documentation suggests that such parameters may be tricky in Windows and Unix is piece of cake, but still I don't get how to use QProcess. What i tried was:
a) puttin the whole command in QString and passing it to QProcess::start(QString) (without separate arguments)
b)
QString command = "convert";
QStringList args;
args
<<"/tmp/mapin.png"
<<"-matte"
<<"-virtual-pixel"
<<"transparent"
<<"-define"
<<"distort:viewport=1105x3241+4572829+2684426"
<<"-distort"
<<"Perspective"
<<"'592,154 4572830,2684542 1408,54 4573934,2684426 654,2432 4572942,2687666'"
<<"+repage"
<<"/tmp/mapout.png";
iProcess->start(command,args);
and some variations of b) (escaping spaces "\ ", escaping single quotes "\'", using double quotes instead of single ones and some other. In all cases finished(int,status) signal is emited with arguments 0,1 (1 is bad, right?), the output image is produced but not distorted according to -distort Perspective '(...)' , so (probably) some arguments are passed correctly, but this one is ignored as faulty.
How do i pass it correctly?
I'm trying to use ImageMagick with QProcess under Linux. The arguments are quite complicated, the whole command needed is for example:
convert /tmp/temporaryPicture20.png -matte -virtual-pixel transparent -define distort:viewport=1105x3241+4572829+2684426 -distort Perspective '592,154 4572830,2684542 1408,54 4573934,2684426 654,2432 4572942,2687666 ' +repage /tmp/temporaryPicture20_out.png
Documentation suggests that such parameters may be tricky in Windows and Unix is piece of cake, but still I don't get how to use QProcess. What i tried was:
a) puttin the whole command in QString and passing it to QProcess::start(QString) (without separate arguments)
b)
QString command = "convert";
QStringList args;
args
<<"/tmp/mapin.png"
<<"-matte"
<<"-virtual-pixel"
<<"transparent"
<<"-define"
<<"distort:viewport=1105x3241+4572829+2684426"
<<"-distort"
<<"Perspective"
<<"'592,154 4572830,2684542 1408,54 4573934,2684426 654,2432 4572942,2687666'"
<<"+repage"
<<"/tmp/mapout.png";
iProcess->start(command,args);
and some variations of b) (escaping spaces "\ ", escaping single quotes "\'", using double quotes instead of single ones and some other. In all cases finished(int,status) signal is emited with arguments 0,1 (1 is bad, right?), the output image is produced but not distorted according to -distort Perspective '(...)' , so (probably) some arguments are passed correctly, but this one is ignored as faulty.
How do i pass it correctly?