Skip to content

Commit

Permalink
Fixed radial_gradient I mode
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 22, 2021
1 parent d7d3f70 commit b04de58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Tests/test_image.py
Expand Up @@ -545,7 +545,7 @@ def test_radial_gradient(self):

# Arrange
target_file = "Tests/images/radial_gradient.png"
for mode in ["L", "P"]:
for mode in ["L", "P", "I"]:

# Act
im = Image.radial_gradient(mode)
Expand Down
7 changes: 5 additions & 2 deletions src/libImaging/Fill.c
Expand Up @@ -112,9 +112,12 @@ ImagingFillRadialGradient(const char *mode) {
d = (int)sqrt(
(double)((x - 128) * (x - 128) + (y - 128) * (y - 128)) * 2.0);
if (d >= 255) {
im->image8[y][x] = 255;
} else {
d = 255;
}
if (im->image8) {
im->image8[y][x] = d;
} else {
im->image32[y][x] = d;
}
}
}
Expand Down

0 comments on commit b04de58

Please sign in to comment.