来自python脚本的ImageMagick bash命令

2024-05-16 05:16:42 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我有这个命令:

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,59,57)\' -draw \'color 0,0 floodfill\' mask_test2.png")
magick.exe: unable to open image ''sRGB(57,59,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,59,57)' -draw 'color 0,0 floodfill' mask_test2.png", returncode=1)
>>>

如果有人能指出如何绕过这个问题,这将是非常受欢迎的

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

>>> subprocess.run("magick.exe test.png -debug All -fill \'sRGB(57,59,57)\' -draw \'color 0,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,0)
    bkgd_scale=65535.  ping_background=(0,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,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,59,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,59,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,59,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,59,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,59,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,59,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,59,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,59,57)' -draw 'color 0,0 floodfill' mask_test2.png", returncode=1)

EDIT2-这是有问题的图像。enter image description here


Tags: testimagecachebasepngconfigureexeimagemagick
1条回答
网友
1楼 · 发布于 2024-05-16 05:16:42

你把绳子脱错了。试试这个:

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

注意,我删除了从\'sRGB(57,59,57)\'sRGB(57,59,57)'的反斜杠,在-draw参数中也是如此

此外,将命令拆分为列表也有助于:

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

我在Linux上使用convert而不是magick.exe,但想法是一样的

相关问题 更多 >