mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Copy palette when converting from P to PA
This commit is contained in:
parent
d80e93e435
commit
8a60db322f
|
@ -236,6 +236,12 @@ def test_p2pa_alpha():
|
||||||
assert im_a.getpixel((x, y)) == alpha
|
assert im_a.getpixel((x, y)) == alpha
|
||||||
|
|
||||||
|
|
||||||
|
def test_p2pa_palette():
|
||||||
|
with Image.open("Tests/images/tiny.png") as im:
|
||||||
|
im_pa = im.convert("PA")
|
||||||
|
assert im_pa.getpalette() == im.getpalette()
|
||||||
|
|
||||||
|
|
||||||
def test_matrix_illegal_conversion():
|
def test_matrix_illegal_conversion():
|
||||||
# Arrange
|
# Arrange
|
||||||
im = hopper("CMYK")
|
im = hopper("CMYK")
|
||||||
|
|
|
@ -1243,7 +1243,7 @@ frompalette(Imaging imOut, Imaging imIn, const char *mode) {
|
||||||
if (!imOut) {
|
if (!imOut) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (strcmp(mode, "P") == 0) {
|
if (strcmp(mode, "P") == 0 || strcmp(mode, "PA") == 0) {
|
||||||
ImagingPaletteDelete(imOut->palette);
|
ImagingPaletteDelete(imOut->palette);
|
||||||
imOut->palette = ImagingPaletteDuplicate(imIn->palette);
|
imOut->palette = ImagingPaletteDuplicate(imIn->palette);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user