anylabeling icon indicating copy to clipboard operation
anylabeling copied to clipboard

Brightness/Contrast adjustment crashes and close the software

Open maulakhan opened this issue 1 year ago • 0 comments

Hello,

We have been using anylabeling for doing polygonal image labeling. Our images are grayscale, single channel, 16-bit tiff images created by "tifffile" python library. It works great and its very user friendly. However, we are facing an issue that whenever we try to do brightness/contrast adjustment using the GUI, it crashes and closes the software. On windows, we get this error in the terminal window:

Traceback (most recent call last):
  File "C:\Users\joker\Miniconda3\envs\anylabeling\Lib\site-packages\anylabeling\views\labeling\widgets\brightness_contrast_dialog.py", line 37, in on_new_value
    img = PIL.ImageEnhance.Brightness(img).enhance(brightness)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joker\Miniconda3\envs\anylabeling\Lib\site-packages\PIL\ImageEnhance.py", line 40, in enhance
    return Image.blend(self.degenerate, self.image, factor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\joker\Miniconda3\envs\anylabeling\Lib\site-packages\PIL\Image.py", line 3540, in blend
    return im1._new(core.blend(im1.im, im2.im, alpha))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: image has wrong mode

Can you please help us to understand how we can use this function correctly, so that it doesn't crash.

Thank you very much

maulakhan avatar Nov 06 '24 13:11 maulakhan