Windows 10 System Command Issue
Posted: 2019-06-03T23:51:10-07:00
Hi,
I'm probably doing things the dumbest way possible, but I put together a small code that uses ImageMagick 7.0.8 to do a very simple overlay. I have a fortran code compiled with Intel Parallel Studio that does get all the setup information and then issues a system command to run ImageMagick to do all the heavy lifting for the overlay. The issue I'm having is that when I either issue a system command in the fortran code or even try to run ImageMagick with a batch script it fails, but if I take that exact same command and just copy and paste it into either a terminal or powershell window then it works without issue. The code to execute the system command is shown below
! use imagemagick composite to overlay the af point template and export a jpg
imgmgkcmd = "magick composite -gravity center -geometry '"//trim(scaleChar)//"%%x"//&
trim(scaleChar)//"%%"//trim(offsetCharX)//trim(offsetCharY)//"' af_point_EM1X.png "&
//adjustl(trim(fileChar))//" "//adjustl(trim(fileTitle))//".jpg"
write(22,'(A)')adjustl(trim(imgmgkcmd))
! execute the image magick command
call execute_command_line(trim(imgmgkcmd))
and what actually goes to the command line looks like the example below (which works if pasted in).
magick composite -gravity center -geometry '200%%x200%%+508-1100' af_point_EM1X.png P6012527.ORF P6012527.jpg
Any ideas? When it fails, it seems to be mostly complaining about the argument passed to -geometry. I assume I must be doing something pretty dumb.
EDIT: Bah, nevermind I got it like 30 seconds after posting this. Changing from single to double quotes seemed to fix the issue.
I'm probably doing things the dumbest way possible, but I put together a small code that uses ImageMagick 7.0.8 to do a very simple overlay. I have a fortran code compiled with Intel Parallel Studio that does get all the setup information and then issues a system command to run ImageMagick to do all the heavy lifting for the overlay. The issue I'm having is that when I either issue a system command in the fortran code or even try to run ImageMagick with a batch script it fails, but if I take that exact same command and just copy and paste it into either a terminal or powershell window then it works without issue. The code to execute the system command is shown below
! use imagemagick composite to overlay the af point template and export a jpg
imgmgkcmd = "magick composite -gravity center -geometry '"//trim(scaleChar)//"%%x"//&
trim(scaleChar)//"%%"//trim(offsetCharX)//trim(offsetCharY)//"' af_point_EM1X.png "&
//adjustl(trim(fileChar))//" "//adjustl(trim(fileTitle))//".jpg"
write(22,'(A)')adjustl(trim(imgmgkcmd))
! execute the image magick command
call execute_command_line(trim(imgmgkcmd))
and what actually goes to the command line looks like the example below (which works if pasted in).
magick composite -gravity center -geometry '200%%x200%%+508-1100' af_point_EM1X.png P6012527.ORF P6012527.jpg
Any ideas? When it fails, it seems to be mostly complaining about the argument passed to -geometry. I assume I must be doing something pretty dumb.
EDIT: Bah, nevermind I got it like 30 seconds after posting this. Changing from single to double quotes seemed to fix the issue.