was-node-suite-comfyui icon indicating copy to clipboard operation
was-node-suite-comfyui copied to clipboard

Image Levels Adjustment math domain error

Open nieli123456 opened this issue 1 year ago • 1 comments

ComfyUI Error Report

Error Details

  • Node Type: Image Levels Adjustment
  • Exception Type: ValueError
  • Exception Message: math domain error

Stack Trace

  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)

  File "D:\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 6203, in apply_image_levels
    tensor_images.append(pil2tensor(levels.adjust(img)))
                                    ^^^^^^^^^^^^^^^^^^

  File "D:\ComfyUI_windows_portable\ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 6225, in adjust
    gamma = math.log(0.5) / math.log((self.mid_level - self.min_level) / (self.max_level - self.min_level))

nieli123456 avatar Sep 23 '24 07:09 nieli123456

Be sure your black level isn't higher than mid level, and vice versa. Black, must be lower than mid, and mid lower than high.

https://github.com/WASasquatch/was-node-suite-comfyui/issues/475#issuecomment-2366902958

WASasquatch avatar Sep 23 '24 15:09 WASasquatch