mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Back to RGBx format, 3 bands in 4 bytes. Tests for internal consistency
This commit is contained in:
		
							parent
							
								
									215b61aadf
								
							
						
					
					
						commit
						4458787f5e
					
				
							
								
								
									
										
											BIN
										
									
								
								Tests/images/lab.tif
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/lab.tif
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										25
									
								
								Tests/test_image_lab.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Tests/test_image_lab.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
from tester import *
 | 
			
		||||
 | 
			
		||||
from PIL import Image
 | 
			
		||||
 | 
			
		||||
def test_sanity():
 | 
			
		||||
    i = Image.open('Tests/images/lab.tif')
 | 
			
		||||
 | 
			
		||||
    bits = i.load()
 | 
			
		||||
    
 | 
			
		||||
    assert_equal(i.mode, 'LAB')
 | 
			
		||||
 | 
			
		||||
    assert_equal(i.getbands(), ('L','A', 'B'))
 | 
			
		||||
 | 
			
		||||
    k = i.getpixel((0,0))
 | 
			
		||||
    assert_equal(k, (255,0,0))
 | 
			
		||||
 | 
			
		||||
    L  = i.getdata(0)
 | 
			
		||||
    a = i.getdata(1)
 | 
			
		||||
    b = i.getdata(2)
 | 
			
		||||
 | 
			
		||||
    assert_equal(list(L), [255]*100)
 | 
			
		||||
    assert_equal(list(a), [0]*100)
 | 
			
		||||
    assert_equal(list(b), [0]*100)
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -527,7 +527,7 @@ static struct {
 | 
			
		|||
    {"YCbCr",  	"Cr",           8,      band2},
 | 
			
		||||
 | 
			
		||||
    /* LAB Color */
 | 
			
		||||
    {"LAB",	    "LAB",	       24,     copy3},
 | 
			
		||||
    {"LAB",	    "LAB",	       24,     ImagingPackRGB},
 | 
			
		||||
    {"LAB",  	"L",           8,      band0},
 | 
			
		||||
    {"LAB",  	"A",           8,      band1},
 | 
			
		||||
    {"LAB",  	"B",           8,      band2},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -182,9 +182,8 @@ ImagingNewPrologueSubtype(const char *mode, unsigned xsize, unsigned ysize,
 | 
			
		|||
        /* 24-bit color, luminance, + 2 color channels */
 | 
			
		||||
        /* L is uint8, a,b are int8 */
 | 
			
		||||
        im->bands = 3;
 | 
			
		||||
        im->pixelsize = 3;
 | 
			
		||||
        im->linesize = (xsize*4 + 3) & -4;
 | 
			
		||||
        im->type = IMAGING_TYPE_SPECIAL;
 | 
			
		||||
        im->pixelsize = 4;
 | 
			
		||||
        im->linesize = xsize * 4;
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
        free(im);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -965,7 +965,7 @@ static struct {
 | 
			
		|||
    {"YCbCr",   "YCbCrK",       32,     copy4},
 | 
			
		||||
 | 
			
		||||
    /* LAB Color */
 | 
			
		||||
    {"LAB",	    "LAB",	        24,	    copy3},
 | 
			
		||||
    {"LAB",	    "LAB",	        24,	    ImagingUnpackRGB},
 | 
			
		||||
    {"LAB",  	"L",            8,      band0},
 | 
			
		||||
    {"LAB",  	"A",            8,      band1},
 | 
			
		||||
    {"LAB",  	"B",            8,      band2},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user