(img, add, thresh=128, **__)
| 127 | |
| 128 | |
| 129 | def solarize_add(img, add, thresh=128, **__): |
| 130 | lut = [] |
| 131 | for i in range(256): |
| 132 | if i < thresh: |
| 133 | lut.append(min(255, i + add)) |
| 134 | else: |
| 135 | lut.append(i) |
| 136 | if img.mode in ("L", "RGB"): |
| 137 | if img.mode == "RGB" and len(lut) == 256: |
| 138 | lut = lut + lut + lut |
| 139 | return img.point(lut) |
| 140 | else: |
| 141 | return img |
| 142 | |
| 143 | |
| 144 | def posterize(img, bits_to_keep, **__): |
nothing calls this directly
no outgoing calls
no test coverage detected