Imagemagick Bash Command From Python Script
So I have this command: PS C:\Users\lucas\OneDrive\Documents\3D\OpenRCT2\HotdogCycles> magick.exe test.png -fill 'sRGB(57,59,57)' -draw 'color 0,0 floodfill' mask_test2.png Whi
Solution 1:
You've got the string escaping wrong. Try this:
>>>subprocess.run("magick.exe test.png -fill 'sRGB(57,59,57)' -draw 'color 0,0 floodfill' mask_test2.png")
Note that I removed the back-slashes from \'sRGB(57,59,57)\'
to sRGB(57,59,57)'
, likewise in the -draw
argument.
Also splitting the command to a list could help:
>>>subprocess.run(["/usr/bin/convert", "test.png", "-fill", "sRGB(57,59,57)", "-draw", "color 0,0 floodfill", "mask_test2.png"])
I user convert
rather than magick.exe
as I'm on Linux, but the idea is the same.
Post a Comment for "Imagemagick Bash Command From Python Script"