0

I've been successfully using skimage's io.imsave to save images. However, after installing the `imutils` package through Anaconda (conda install -c conda-forge imutils), which also updated some packages, I've started encountering the following error messages.


  File "C:\Users\user\.conda\envs\py38\lib\site-packages\spyder_kernels\py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "\\company.com\data\p\user\python codes\met_codes\met_script.py", line 427, in <module>
    io.imsave(path, img)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\skimage\io\_io.py", line 143, in imsave
    return call_plugin('imsave', fname, arr, plugin=plugin, **plugin_args)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\skimage\io\manage_plugins.py", line 207, in call_plugin
    return func(*args, **kwargs)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\imageio\v2.py", line 239, in imwrite
    return file.write(im, **kwargs)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\imageio\core\legacy_plugin_wrapper.py", line 229, in write
    writer.append_data(image)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\imageio\core\format.py", line 589, in append_data
    return self._append_data(im, total_meta)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\imageio\plugins\pillow_legacy.py", line 540, in _append_data
    PillowFormat.Writer._append_data(self, im, meta)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\imageio\plugins\pillow_legacy.py", line 382, in _append_data
    img.save(self._fp, format=self.format.plugin_id, **self._meta)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\PIL\Image.py", line 2320, in save
    -rotn_center[0] - post_trans[0], -rotn_center[1] - post_trans[1], matrix

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\PIL\JpegImagePlugin.py", line 806, in _save
    ImageFile._save(im, fp, [("jpeg", (0, 0) + im.size, 0, rawmode)], bufsize)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\PIL\ImageFile.py", line 520, in _save
    _encode_tile(im, fp, tile, bufsize, fh)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\PIL\ImageFile.py", line 531, in _encode_tile
    encoder = Image._getencoder(im.mode, e, a, im.encoderconfig)

  File "C:\Users\user\.conda\envs\py38\lib\site-packages\PIL\Image.py", line 426, in _getencoder
    encoder = ENCODERS[encoder_name]

TypeError: function takes at most 13 arguments (14 given)

Although I understand that I could switch to using cv2.imwrite, I'd prefer to avoid modifying my existing scripts that use io.imsave. Could you assist me in resolving this problem?

path = "img_out.jpg"
io.imsave(path, img, check_contrast=False,quality=100)
Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
lou_a
  • 1
  • 2

0 Answers0