"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "4eb9ad0d1c7cc86a4c533b0da261e9bf57128166"
Unverified Commit ab0b9a43 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Make adjust_hue() work with numpy 2.0 (#8463)

parent 6e18cea3
...@@ -109,9 +109,9 @@ def adjust_hue(img: Image.Image, hue_factor: float) -> Image.Image: ...@@ -109,9 +109,9 @@ def adjust_hue(img: Image.Image, hue_factor: float) -> Image.Image:
h, s, v = img.convert("HSV").split() h, s, v = img.convert("HSV").split()
np_h = np.array(h, dtype=np.uint8) np_h = np.array(h, dtype=np.uint8)
# uint8 addition take cares of rotation across boundaries # This will over/underflow, as desired
with np.errstate(over="ignore"): np_h += np.array(hue_factor * 255).astype(np.uint8)
np_h += np.uint8(hue_factor * 255)
h = Image.fromarray(np_h, "L") h = Image.fromarray(np_h, "L")
img = Image.merge("HSV", (h, s, v)).convert(input_mode) img = Image.merge("HSV", (h, s, v)).convert(input_mode)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment