mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	Corrected border position
This commit is contained in:
		
							parent
							
								
									28330c2f9d
								
							
						
					
					
						commit
						3e5ceb6d67
					
				|  | @ -161,7 +161,13 @@ def test_expand_palette(): | ||||||
|     im_expanded = ImageOps.expand(im, 10, (255, 0, 0)) |     im_expanded = ImageOps.expand(im, 10, (255, 0, 0)) | ||||||
| 
 | 
 | ||||||
|     px = im_expanded.convert("RGB").load() |     px = im_expanded.convert("RGB").load() | ||||||
|     assert px[0, 0] == (255, 0, 0) |     for b in range(10): | ||||||
|  |         for x in range(im_expanded.width): | ||||||
|  |             assert px[x, b] == (255, 0, 0) | ||||||
|  |             assert px[x, im_expanded.height - 1 - b] == (255, 0, 0) | ||||||
|  |         for y in range(im_expanded.height): | ||||||
|  |             assert px[b, x] == (255, 0, 0) | ||||||
|  |             assert px[b, im_expanded.width - 1 - b] == (255, 0, 0) | ||||||
| 
 | 
 | ||||||
|     im_cropped = im_expanded.crop( |     im_cropped = im_expanded.crop( | ||||||
|         (10, 10, im_expanded.width - 10, im_expanded.height - 10) |         (10, 10, im_expanded.width - 10, im_expanded.height - 10) | ||||||
|  |  | ||||||
|  | @ -399,7 +399,7 @@ def expand(image, border=0, fill=0): | ||||||
|         out.paste(image, (left, top)) |         out.paste(image, (left, top)) | ||||||
| 
 | 
 | ||||||
|         draw = ImageDraw.Draw(out) |         draw = ImageDraw.Draw(out) | ||||||
|         draw.rectangle((0, 0, width, height), outline=color, width=border) |         draw.rectangle((0, 0, width - 1, height - 1), outline=color, width=border) | ||||||
|     else: |     else: | ||||||
|         out = Image.new(image.mode, (width, height), color) |         out = Image.new(image.mode, (width, height), color) | ||||||
|         out.paste(image, (left, top)) |         out.paste(image, (left, top)) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user