mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-01 00:17:27 +03:00 
			
		
		
		
	Merge pull request #6481 from radarhere/psd_rgba
Added support for RGBA PSD images
This commit is contained in:
		
						commit
						38e411de42
					
				
							
								
								
									
										
											BIN
										
									
								
								Tests/images/rgba.psd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/rgba.psd
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -4,7 +4,7 @@ import pytest | ||||||
| 
 | 
 | ||||||
| from PIL import Image, PsdImagePlugin | from PIL import Image, PsdImagePlugin | ||||||
| 
 | 
 | ||||||
| from .helper import assert_image_similar, hopper, is_pypy | from .helper import assert_image_equal_tofile, assert_image_similar, hopper, is_pypy | ||||||
| 
 | 
 | ||||||
| test_file = "Tests/images/hopper.psd" | test_file = "Tests/images/hopper.psd" | ||||||
| 
 | 
 | ||||||
|  | @ -107,6 +107,11 @@ def test_open_after_exclusive_load(): | ||||||
|         im.load() |         im.load() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def test_rgba(): | ||||||
|  |     with Image.open("Tests/images/rgba.psd") as im: | ||||||
|  |         assert_image_equal_tofile(im, "Tests/images/imagedraw_square.png") | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def test_icc_profile(): | def test_icc_profile(): | ||||||
|     with Image.open(test_file) as im: |     with Image.open(test_file) as im: | ||||||
|         assert "icc_profile" in im.info |         assert "icc_profile" in im.info | ||||||
|  |  | ||||||
|  | @ -75,6 +75,9 @@ class PsdImageFile(ImageFile.ImageFile): | ||||||
| 
 | 
 | ||||||
|         if channels > psd_channels: |         if channels > psd_channels: | ||||||
|             raise OSError("not enough channels") |             raise OSError("not enough channels") | ||||||
|  |         if mode == "RGB" and psd_channels == 4: | ||||||
|  |             mode = "RGBA" | ||||||
|  |             channels = 4 | ||||||
| 
 | 
 | ||||||
|         self.mode = mode |         self.mode = mode | ||||||
|         self._size = i32(s, 18), i32(s, 14) |         self._size = i32(s, 18), i32(s, 14) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user