mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Use current frame for transparency detection
This commit is contained in:
		
							parent
							
								
									d1f40a94ff
								
							
						
					
					
						commit
						31d36e6b70
					
				| 
						 | 
				
			
			@ -208,7 +208,7 @@ class TestFileWebp:
 | 
			
		|||
 | 
			
		||||
    def test_background_from_gif(self, tmp_path: Path) -> None:
 | 
			
		||||
        out_webp = tmp_path / "temp.webp"
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        # Save L mode GIF with background
 | 
			
		||||
        with Image.open("Tests/images/no_palette_with_background.gif") as im:
 | 
			
		||||
            im.save(out_webp, save_all=True)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -243,7 +243,9 @@ def _save_all(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
 | 
			
		|||
                # Make sure image mode is supported
 | 
			
		||||
                frame = ims
 | 
			
		||||
                if frame.mode not in ("RGBX", "RGBA", "RGB"):
 | 
			
		||||
                    frame = frame.convert("RGBA" if im.has_transparency_data else "RGB")
 | 
			
		||||
                    frame = frame.convert(
 | 
			
		||||
                        "RGBA" if frame.has_transparency_data else "RGB"
 | 
			
		||||
                    )
 | 
			
		||||
 | 
			
		||||
                # Append the frame to the animation encoder
 | 
			
		||||
                enc.add(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user