python脚本中的ImageMagick bash命令

如何解决python脚本中的ImageMagick bash命令

所以我有以下命令:

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

哪个运行正常。我需要从python脚本运行它。因此,为了进行测试,我在同一目录中打开一个python shell并运行相同的命令。

PS C:\Users\lucas\OneDrive\Documents\3D\OpenRCT2\HotdogCycles> python
Python 3.8.2 (tags/v3.8.2:7b3ab59,Feb 25 2020,22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Type "help","copyright","credits" or "license" for more information.
>>> import subprocess
>>> subprocess.run("magick.exe test.png -fill \'sRGB(57,57)\' -draw \'color 0,0 floodfill\' mask_test2.png")
magick.exe: unable to open image ''sRGB(57,57)'': No such file or directory @ error/blob.c/OpenBlob/3537.
magick.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/562.
CompletedProcess(args="magick.exe test.png -fill 'sRGB(57,0 floodfill' mask_test2.png",returncode=1)
>>>

如果任何人都可以找到解决该问题的方法,这将是非常受欢迎的!

编辑-调试消息(不知道有这样的事情)

>>> subprocess.run("magick.exe test.png -debug All -fill \'sRGB(57,0 floodfill\' mask_test2.png"
... )
2020-08-11T00:30:17+00:00 0:00.001 0.000u 7.0.10 Wand magick.exe[15196]: wandcli.c/AcquireMagickCLI/131/Wand
  MagickWandCLI-0
2020-08-11T00:30:17+00:00 0:00.010 0.000u 7.0.10 Command magick.exe[15196]: magick-cli.c/MagickImageCommand/709/Command
  Initializing "magick.exe"
2020-08-11T00:30:17+00:00 0:00.020 0.000u 7.0.10 Configure magick.exe[15196]: client.c/SetClientName/123/Configure
  magick.exe
2020-08-11T00:30:17+00:00 0:00.029 0.000u 7.0.10 Command magick.exe[15196]: magick-cli.c/ProcessCommandOptions/388/Command
  at CLI arg 1 - Starting ("test.png")
2020-08-11T00:30:17+00:00 0:00.040 0.000u 7.0.10 Command magick.exe[15196]: operation.c/CLINoImageOperator/4746/Command
  at CLI arg 1 - NoImage Operator: -read "test.png" ""
2020-08-11T00:30:17+00:00 0:00.053 0.016u 7.0.10 Configure magick.exe[15196]: utility.c/ExpandFilenames/971/Configure
  Command line: test.png
2020-08-11T00:30:17+00:00 0:00.062 0.016u 7.0.10 Policy magick.exe[15196]: policy.c/IsRightsAuthorized/611/Policy
  Domain: Module; rights=Read; pattern="PNG" ...
2020-08-11T00:30:17+00:00 0:00.073 0.016u 7.0.10 Module magick.exe[15196]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "IM_MOD_RL_PNG_.dll"
2020-08-11T00:30:17+00:00 0:00.085 0.016u 7.0.10 Module magick.exe[15196]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "IM_MOD_RL_PNG_.dll" ...
2020-08-11T00:30:17+00:00 0:00.096 0.031u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2096/Configure
  SOFTWARE\ImageMagick\7.0.10\Q:16
2020-08-11T00:30:17+00:00 0:00.107 0.031u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2114/Configure
  CoderModulesPath
2020-08-11T00:30:17+00:00 0:00.117 0.047u 7.0.10 Module magick.exe[15196]: module.c/OpenModule/1282/Module
  Opening module at path "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\modules\coders\IM_MOD_RL_PNG_.dll"
2020-08-11T00:30:17+00:00 0:00.131 0.063u 7.0.10 Module magick.exe[15196]: module.c/OpenModule/1309/Module
  Method "RegisterPNGImage" in module "PNG" at address 00007FFE4001D120
2020-08-11T00:30:17+00:00 0:00.143 0.078u 7.0.10 Module magick.exe[15196]: module.c/OpenModule/1323/Module
  Method "UnregisterPNGImage" in module "PNG" at address 00007FFE4001D710
2020-08-11T00:30:17+00:00 0:00.155 0.078u 7.0.10 Policy magick.exe[15196]: policy.c/IsRightsAuthorized/611/Policy
  Domain: Path; rights=Read; pattern="test.png" ...
2020-08-11T00:30:17+00:00 0:00.166 0.078u 7.0.10 Blob magick.exe[15196]: blob.c/OpenBlob/3430/Blob
    read 3 magic header bytes
2020-08-11T00:30:17+00:00 0:00.175 0.078u 7.0.10 Cache magick.exe[15196]: cache.c/DestroyPixelCache/1043/Cache
  destroy
2020-08-11T00:30:17+00:00 0:00.183 0.078u 7.0.10 Policy magick.exe[15196]: policy.c/IsRightsAuthorized/611/Policy
  Domain: Path; rights=Read; pattern="test.png" ...
2020-08-11T00:30:17+00:00 0:00.194 0.094u 7.0.10 Blob magick.exe[15196]: blob.c/OpenBlob/3430/Blob
    read 3 magic header bytes
2020-08-11T00:30:17+00:00 0:00.203 0.094u 7.0.10 Cache magick.exe[15196]: cache.c/DestroyPixelCache/1043/Cache
  destroy
2020-08-11T00:30:17+00:00 0:00.211 0.094u 7.0.10 Policy magick.exe[15196]: policy.c/IsRightsAuthorized/611/Policy
  Domain: Coder; rights=Read; pattern="PNG" ...
2020-08-11T00:30:17+00:00 0:00.221 0.094u 7.0.10 Coder magick.exe[15196]: png.c/ReadPNGImage/4273/Coder
  Enter ReadPNGImage()
2020-08-11T00:30:17+00:00 0:00.230 0.094u 7.0.10 Policy magick.exe[15196]: policy.c/IsRightsAuthorized/611/Policy
  Domain: Path; rights=Read; pattern="test.png" ...
2020-08-11T00:30:17+00:00 0:00.241 0.109u 7.0.10 Blob magick.exe[15196]: blob.c/OpenBlob/3430/Blob
    read 3 magic header bytes
2020-08-11T00:30:17+00:00 0:00.250 0.109u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/2301/Coder
    Enter ReadOnePNGImage()
    IM version     = 7.0.10-26
    Libpng version = 1.6.37
2020-08-11T00:30:17+00:00 0:00.263 0.125u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/2311/Coder
      Zlib version   = 1.2.11
2020-08-11T00:30:17+00:00 0:00.272 0.125u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/2341/Coder
      Before reading:
      image->alpha_trait=0
      image->rendering_intent=2
      image->colorspace=23
      image->gamma=0.454545
2020-08-11T00:30:17+00:00 0:00.292 0.125u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/2656/Coder
      PNG width: 128,height: 256
    PNG color_type: 0,bit_depth: 8
    PNG compression_method: 0
    PNG interlace_method: 0,filter_method: 0
2020-08-11T00:30:17+00:00 0:00.313 0.141u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/2680/Coder
      Found PNG gAMA chunk.
2020-08-11T00:30:17+00:00 0:00.324 0.156u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/2688/Coder
      Found PNG cHRM chunk.
2020-08-11T00:30:17+00:00 0:00.335 0.156u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/2857/Coder
      Reading PNG gAMA chunk: gamma: 0.454550
2020-08-11T00:30:17+00:00 0:00.346 0.172u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/2976/Coder
      Reading PNG pHYs chunk: xres: 2835,yres: 2835,units: 1.
2020-08-11T00:30:17+00:00 0:00.360 0.172u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3084/Coder
      Reading PNG bKGD chunk,raw ping_background=(0,0)
    bkgd_scale=65535.  ping_background=(0,0)
2020-08-11T00:30:17+00:00 0:00.376 0.188u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3105/Coder
      image->background_color=(0,0).
2020-08-11T00:30:17+00:00 0:00.390 0.203u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3215/Coder
      image->gamma=0.454550
2020-08-11T00:30:17+00:00 0:00.401 0.219u 7.0.10 Resource magick.exe[15196]: resource.c/AcquireMagickResource/390/Resource
  ListLength: 1/0/9.22337E
2020-08-11T00:30:17+00:00 0:00.414 0.219u 7.0.10 Pixel magick.exe[15196]: pixel.c/SetPixelChannelMask/6294/Pixel
  test.png[07ffffff]
2020-08-11T00:30:17+00:00 0:00.425 0.219u 7.0.10 Pixel magick.exe[15196]: pixel.c/LogPixelChannels/6178/Pixel
  test.png[07ffffff]
2020-08-11T00:30:17+00:00 0:00.435 0.219u 7.0.10 Pixel magick.exe[15196]: pixel.c/LogPixelChannels/6275/Pixel
    0: gray (update)
2020-08-11T00:30:17+00:00 0:00.446 0.234u 7.0.10 Resource magick.exe[15196]: resource.c/AcquireMagickResource/390/Resource
  Area: 32768B/0B/27.954GiB
2020-08-11T00:30:17+00:00 0:00.460 0.234u 7.0.10 Resource magick.exe[15196]: resource.c/AcquireMagickResource/390/Resource
  Memory: 131072B/131072B/13.977GiB
2020-08-11T00:30:17+00:00 0:00.472 0.250u 7.0.10 Cache magick.exe[15196]: cache.c/OpenPixelCache/3777/Cache
  open test.png[0] (Heap Memory,128x256x1 131072B)
2020-08-11T00:30:17+00:00 0:00.483 0.250u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3270/Coder
      image->colorspace=3
2020-08-11T00:30:17+00:00 0:00.494 0.250u 7.0.10 Resource magick.exe[15196]: resource.c/AcquireMagickResource/390/Resource
  ListLength: 1/0/9.22337E
2020-08-11T00:30:17+00:00 0:00.509 0.266u 7.0.10 Pixel magick.exe[15196]: pixel.c/SetPixelChannelMask/6294/Pixel
  test.png[07ffffff]
2020-08-11T00:30:17+00:00 0:00.519 0.281u 7.0.10 Pixel magick.exe[15196]: pixel.c/LogPixelChannels/6178/Pixel
  test.png[07ffffff]
2020-08-11T00:30:17+00:00 0:00.530 0.281u 7.0.10 Pixel magick.exe[15196]: pixel.c/LogPixelChannels/6275/Pixel
    0: gray (update)
2020-08-11T00:30:17+00:00 0:00.540 0.281u 7.0.10 Pixel magick.exe[15196]: pixel.c/LogPixelChannels/6275/Pixel
    1: index (copy)
2020-08-11T00:30:17+00:00 0:00.550 0.297u 7.0.10 Resource magick.exe[15196]: resource.c/AcquireMagickResource/390/Resource
  Area: 32768B/0B/27.954GiB
2020-08-11T00:30:17+00:00 0:00.563 0.297u 7.0.10 Resource magick.exe[15196]: resource.c/AcquireMagickResource/390/Resource
  Memory: 262144B/393216B/13.977GiB
2020-08-11T00:30:17+00:00 0:00.576 0.313u 7.0.10 Cache magick.exe[15196]: cache.c/ClonePixelCacheRepository/843/Cache
  Memory => Memory
2020-08-11T00:30:17+00:00 0:00.587 0.313u 7.0.10 Resource magick.exe[15196]: resource.c/RelinquishMagickResource/1070/Resource
  Memory: 131072B/262144B/13.977GiB
2020-08-11T00:30:17+00:00 0:00.599 0.313u 7.0.10 Cache magick.exe[15196]: cache.c/OpenPixelCache/3777/Cache
  open test.png[0] (Heap Memory,128x256x2 262144B)
2020-08-11T00:30:17+00:00 0:00.612 0.328u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3424/Coder
      Reading PNG IDAT chunk(s)
2020-08-11T00:30:17+00:00 0:00.622 0.328u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3450/Coder
      Converting PNG pixels to pixel packets
2020-08-11T00:30:17+00:00 0:00.634 0.344u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3594/Coder
      Converting grayscale pixels to pixel packets
2020-08-11T00:30:17+00:00 0:00.647 0.344u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3775/Coder
      No transparent pixel was found
2020-08-11T00:30:18+00:00 0:00.660 0.344u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3788/Coder
    image->storage_class=2

2020-08-11T00:30:18+00:00 0:00.673 0.344u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.685 0.344u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 6
      Keyword: Camera
2020-08-11T00:30:18+00:00 0:00.699 0.359u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.710 0.375u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 8
      Keyword: cycles.View Layer.render_time
2020-08-11T00:30:18+00:00 0:00.727 0.375u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.739 0.375u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 4
      Keyword: cycles.View Layer.samples
2020-08-11T00:30:18+00:00 0:00.752 0.375u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.763 0.375u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 8
      Keyword: cycles.View Layer.synchronization_time
2020-08-11T00:30:18+00:00 0:00.780 0.391u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.791 0.391u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 8
      Keyword: cycles.View Layer.total_time
2020-08-11T00:30:18+00:00 0:00.805 0.391u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.816 0.391u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 19
      Keyword: Date
2020-08-11T00:30:18+00:00 0:00.829 0.391u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.840 0.391u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 25
      Keyword: date:create
2020-08-11T00:30:18+00:00 0:00.853 0.406u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.864 0.406u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 25
      Keyword: date:modify
2020-08-11T00:30:18+00:00 0:00.877 0.406u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.889 0.422u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 76
      Keyword: File
2020-08-11T00:30:18+00:00 0:00.901 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.912 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 3
      Keyword: Frame
2020-08-11T00:30:18+00:00 0:00.926 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.936 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 8
      Keyword: RenderTime
2020-08-11T00:30:18+00:00 0:00.950 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.961 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 5
      Keyword: Scene
2020-08-11T00:30:18+00:00 0:00.976 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3909/Coder
      Reading PNG text chunk
2020-08-11T00:30:18+00:00 0:00.987 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/3974/Coder
        length: 11
      Keyword: Time
2020-08-11T00:30:18+00:00 0:01.000 0.438u 7.0.10 Coder magick.exe[15196]: png.c/ReadOnePNGImage/4226/Coder
    exit ReadOnePNGImage()
2020-08-11T00:30:18+00:00 0:01.012 0.453u 7.0.10 Coder magick.exe[15196]: png.c/ReadPNGImage/4358/Coder
    page.w: 0,page.h: 0,page.x: 0,page.y: 0.
2020-08-11T00:30:18+00:00 0:01.026 0.453u 7.0.10 Coder magick.exe[15196]: png.c/ReadPNGImage/4362/Coder
    image->colorspace: 3
2020-08-11T00:30:18+00:00 0:01.036 0.453u 7.0.10 Coder magick.exe[15196]: png.c/ReadPNGImage/4367/Coder
  exit ReadPNGImage()
2020-08-11T00:30:18+00:00 0:01.047 0.453u 7.0.10 Wand magick.exe[15196]: wandcli.c/CLICatchException/242/Wand
  magick.exe-CLI
2020-08-11T00:30:18+00:00 0:01.058 0.453u 7.0.10 Command magick.exe[15196]: operation.c/CLISettingOptionInfo/458/Command
  at CLI arg 2 - Setting Option: -debug "All" "(null)"
2020-08-11T00:30:18+00:00 0:01.072 0.453u 7.0.10 Wand magick.exe[15196]: wandcli.c/CLICatchException/242/Wand
  magick.exe-CLI
2020-08-11T00:30:18+00:00 0:01.082 0.453u 7.0.10 Command magick.exe[15196]: operation.c/CLISettingOptionInfo/458/Command
  at CLI arg 4 - Setting Option: -fill "'sRGB(57,57)'" "(null)"
2020-08-11T00:30:18+00:00 0:01.099 0.453u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2096/Configure
  SOFTWARE\ImageMagick\7.0.10\Q:16
2020-08-11T00:30:18+00:00 0:01.110 0.453u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2114/Configure
  ConfigurePath
2020-08-11T00:30:18+00:00 0:01.124 0.469u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2096/Configure
  SOFTWARE\ImageMagick\7.0.10\Q:16
2020-08-11T00:30:18+00:00 0:01.140 0.484u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2114/Configure
  ConfigurePath
2020-08-11T00:30:18+00:00 0:01.152 0.484u 7.0.10 Locale magick.exe[15196]: locale.c/GetLocaleOptions/854/Locale
  Searching for locale file: "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\locale.xml"
2020-08-11T00:30:18+00:00 0:01.167 0.484u 7.0.10 Locale magick.exe[15196]: locale.c/GetLocaleOptions/854/Locale
  Searching for locale file: "C:\Users\lucas\AppData\Local\ImageMagick\locale.xml"
2020-08-11T00:30:18+00:00 0:01.183 0.500u 7.0.10 Configure magick.exe[15196]: locale.c/LoadLocaleCache/1206/Configure
  Loading locale configure file "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\locale.xml" ...
2020-08-11T00:30:18+00:00 0:01.199 0.516u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2096/Configure
  SOFTWARE\ImageMagick\7.0.10\Q:16
2020-08-11T00:30:18+00:00 0:01.211 0.531u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2114/Configure
  ConfigurePath
2020-08-11T00:30:18+00:00 0:01.223 0.531u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2096/Configure
  SOFTWARE\ImageMagick\7.0.10\Q:16
2020-08-11T00:30:18+00:00 0:01.235 0.531u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2114/Configure
  ConfigurePath
2020-08-11T00:30:18+00:00 0:01.246 0.531u 7.0.10 Locale magick.exe[15196]: locale.c/GetLocaleOptions/854/Locale
  Searching for locale file: "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\english.xml"
2020-08-11T00:30:18+00:00 0:01.262 0.531u 7.0.10 Locale magick.exe[15196]: locale.c/GetLocaleOptions/854/Locale
  Searching for locale file: "C:\Users\lucas\AppData\Local\ImageMagick\english.xml"
2020-08-11T00:30:18+00:00 0:01.280 0.531u 7.0.10 Configure magick.exe[15196]: locale.c/LoadLocaleCache/1206/Configure
  Loading locale configure file "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\english.xml" ...
2020-08-11T00:30:18+00:00 0:01.300 0.547u 7.0.10 Exception magick.exe[15196]: color.c/QueryColorCompliance/2356/Exception
  unrecognized color `'sRGB(57,57)''
2020-08-11T00:30:18+00:00 0:01.312 0.547u 7.0.10 Policy magick.exe[15196]: policy.c/IsRightsAuthorized/611/Policy
  Domain: Path; rights=Read; pattern="'sRGB(57,57)'" ...
2020-08-11T00:30:18+00:00 0:01.327 0.547u 7.0.10 Exception magick.exe[15196]: blob.c/OpenBlob/3537/Exception
  unable to open image ''sRGB(57,57)'': No such file or directory
2020-08-11T00:30:18+00:00 0:01.341 0.547u 7.0.10 Cache magick.exe[15196]: cache.c/DestroyPixelCache/1043/Cache
  destroy
2020-08-11T00:30:18+00:00 0:01.352 0.547u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2096/Configure
  SOFTWARE\ImageMagick\7.0.10\Q:16
2020-08-11T00:30:18+00:00 0:01.363 0.547u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2114/Configure
  ConfigurePath
2020-08-11T00:30:18+00:00 0:01.375 0.547u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2096/Configure
  SOFTWARE\ImageMagick\7.0.10\Q:16
2020-08-11T00:30:18+00:00 0:01.389 0.563u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTRegistryKeyLookup/2114/Configure
  ConfigurePath
2020-08-11T00:30:18+00:00 0:01.399 0.563u 7.0.10 Configure magick.exe[15196]: configure.c/GetConfigureOptions/675/Configure
  Searching for configure file: "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\delegates.xml"
2020-08-11T00:30:18+00:00 0:01.415 0.563u 7.0.10 Configure magick.exe[15196]: configure.c/GetConfigureOptions/675/Configure
  Searching for configure file: "C:\Users\lucas\AppData\Local\ImageMagick\delegates.xml"
2020-08-11T00:30:18+00:00 0:01.433 0.563u 7.0.10 Configure magick.exe[15196]: delegate.c/LoadDelegateCache/2061/Configure
  Loading delegate configuration file "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\delegates.xml" ...
2020-08-11T00:30:18+00:00 0:01.450 0.563u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTLocateGhostscript/1199/Configure
  Ghostscript ((null)) version 0.00
2020-08-11T00:30:18+00:00 0:01.461 0.563u 7.0.10 Configure magick.exe[15196]: nt-base.c/NTLocateGhostscript/1199/Configure
  Ghostscript ((null)) version 0.00
2020-08-11T00:30:18+00:00 0:01.475 0.563u 7.0.10 Policy magick.exe[15196]: policy.c/IsRightsAuthorized/611/Policy
  Domain: Path; rights=Read; pattern="'sRGB(57,57)'" ...
2020-08-11T00:30:18+00:00 0:01.490 0.563u 7.0.10 Exception magick.exe[15196]: blob.c/OpenBlob/3537/Exception
  unable to open image ''sRGB(57,57)'': No such file or directory
2020-08-11T00:30:18+00:00 0:01.505 0.563u 7.0.10 Cache magick.exe[15196]: cache.c/DestroyPixelCache/1043/Cache
  destroy
2020-08-11T00:30:18+00:00 0:01.516 0.563u 7.0.10 Exception magick.exe[15196]: constitute.c/ReadImage/562/Exception
  no decode delegate for this image format `'
2020-08-11T00:30:18+00:00 0:01.529 0.563u 7.0.10 Wand magick.exe[15196]: wandcli.c/CLICatchException/242/Wand
  magick.exe-CLI
2020-08-11T00:30:18+00:00 0:01.540 0.578u 7.0.10 Command magick.exe[15196]: magick-cli.c/MagickImageCommand/804/Command
  Cleanup "magick.exe"
2020-08-11T00:30:18+00:00 0:01.551 0.594u 7.0.10 Command magick.exe[15196]: magick-cli.c/MagickImageCommand/847/Command
  Exiting "magick.exe"
2020-08-11T00:30:18+00:00 0:01.563 0.594u 7.0.10 Wand magick.exe[15196]: wandcli.c/DestroyMagickCLI/164/Wand
  magick.exe-CLI
2020-08-11T00:30:18+00:00 0:01.574 0.609u 7.0.10 Cache magick.exe[15196]: cache.c/DestroyPixelCache/1043/Cache
  destroy test.png[0]
2020-08-11T00:30:18+00:00 0:01.585 0.609u 7.0.10 Resource magick.exe[15196]: resource.c/RelinquishMagickResource/1070/Resource
  Memory: 262144B/0B/13.977GiB
magick.exe: unable to open image ''sRGB(57,57)'': No such file or directory @ error/blob.c/OpenBlob/3537.
magick.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/562.
CompletedProcess(args="magick.exe test.png -debug All -fill 'sRGB(57,returncode=1)

EDIT2-这是有问题的图像。

enter image description here

解决方法

您的字符串转义错误。试试这个:

>>> subprocess.run("magick.exe test.png -fill 'sRGB(57,59,57)' -draw 'color 0,0 floodfill' mask_test2.png")

请注意,我在\'sRGB(57,57)\'参数中也将反斜杠从sRGB(57,57)'删除到-draw

也可以将命令拆分为一个列表:

>>> subprocess.run(["/usr/bin/convert","test.png","-fill","sRGB(57,57)","-draw","color 0,0 floodfill","mask_test2.png"])

我使用的是convert,而不是Linux上的magick.exe,但是想法是相同的。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-