I'm trying to use connected-components feature in python3.8 (64 bit) script with ImageMagick 6, but I receive error saying I need to install ImageMagick 7.0.8 or greater. Then I tried using latest ImageMagick 7.0.10 and when try to import "Image" appears the error that MagickWand was not found as shown below.
After some research I found here and here some suggestions to install IM 6 32 bits since "a few sources said that Image Magick 7.x is not compatible with magick Wand"
Then if "connected-components" works only with IM 7 but IM 7 has some issues with Wand, is there another alternative to get the coordinates of areas within image like what is obtained with connected-components in ImageMagick?
I've tried in WSL Ubuntu and with Cygwin. Thanks in advance.
This is the error I get trying to use connected-components
using IM 6.9.10-23 Q16 x86_64 20190101.
>>> with Image(filename='input.png') as img:
... objects = img.connected_components()
Traceback (most recent call last):
File "<stdin>", line 20, in <module>
File "/usr/local/lib/python3.8/dist-packages/wand/image.py", line 3891, in connected_components
raise WandLibraryVersionError(msg)
wand.exceptions.WandLibraryVersionError: Method requires ImageMagick version 7.0.8-41 or greater.
The error I get when I try to import Image
using latest IM 7.
>>> from wand.image import Image
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/wand/api.py", line 151, in <module>
libraries = load_library()
File "/usr/local/lib/python3.8/site-packages/wand/api.py", line 140, in load_library
raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: []
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/wand/image.py", line 18, in <module>
from . import assertions
File "/usr/local/lib/python3.8/site-packages/wand/assertions.py", line 155, in <module>
from .color import Color # noqa: E402
File "/usr/local/lib/python3.8/site-packages/wand/color.py", line 10, in <module>
from .api import library
File "/usr/local/lib/python3.8/site-packages/wand/api.py", line 175, in <module>
raise ImportError('MagickWand shared library not found.\n'
ImportError: MagickWand shared library not found.
You probably had not installed ImageMagick library.
Try to install:
http://docs.wand-py.org/en/latest/guide/install.html