Skip to content

Commit 649eaae

Browse files
authored
Merge pull request #5434 from radarhere/text_alpha
2 parents 23f848e + 8bc19ac commit 649eaae

File tree

5 files changed

+5
-2
lines changed

5 files changed

+5
-2
lines changed
55 Bytes
Loading
350 Bytes
Loading

Tests/test_image_paste.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def test_color_mask_L(self):
236236
[
237237
(127, 191, 254, 191),
238238
(111, 207, 206, 110),
239-
(255, 255, 255, 0) if mode == "RGBA" else (127, 254, 127, 0),
239+
(127, 254, 127, 0),
240240
(207, 207, 239, 239),
241241
(191, 191, 190, 191),
242242
(207, 206, 111, 112),

Tests/test_imagefont.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ def test_transparent_background(self):
131131
target = "Tests/images/transparent_background_text.png"
132132
assert_image_similar_tofile(im, target, 4.09)
133133

134+
target = "Tests/images/transparent_background_text_L.png"
135+
assert_image_similar_tofile(im.convert("L"), target, 0.01)
136+
134137
def test_textsize_equal(self):
135138
im = Image.new(mode="RGB", size=(300, 100))
136139
draw = ImageDraw.Draw(im)

src/libImaging/Paste.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ fill_mask_L(
436436
strcmp(imOut->mode, "La") == 0 ||
437437
strcmp(imOut->mode, "LA") == 0 ||
438438
strcmp(imOut->mode, "PA") == 0) &&
439-
i != 3) {
439+
i != 3 && channel_mask != 0) {
440440
channel_mask =
441441
255 - (255 - channel_mask) * (1 - (255 - out[3]) / 255);
442442
}

0 commit comments

Comments
 (0)