@@ -689,41 +689,6 @@ def sobel(image: Image.Image) -> Image.Image:
689689 return out
690690
691691
692- def _neon_blend (
693- original : Image .Image , neon : Image .Image , alpha : float = 0.55
694- ) -> Image .Image :
695- """
696- Blend the original image with its neon/glow layer
697-
698- :param original: Image to blend whith neon layer
699- :param neon: neon Layer
700- :param alpha: controls intensity of neon effect
701- :return: An image
702- """
703- if alpha < 0 :
704- alpha = 0
705- if alpha > 1 :
706- alpha = 1
707-
708- out = Image .new ("RGB" , original .size )
709-
710- for y in range (original .height ):
711- for x in range (original .width ):
712- value1 = original .getpixel ((x , y ))
713- value2 = neon .getpixel ((x , y ))
714- assert isinstance (value1 , tuple )
715- assert isinstance (value2 , tuple )
716-
717- out .putpixel (
718- (x , y ),
719- tuple (
720- int ((1 - alpha ) * value1 [i ] + alpha * value2 [i ]) for i in range (3 )
721- ),
722- )
723-
724- return out
725-
726-
727692def neon_effect (
728693 image : Image .Image , color : tuple [int , int , int ] = (255 , 0 , 255 ), alpha : float = 0.2
729694) -> Image .Image :
@@ -749,7 +714,7 @@ def neon_effect(
749714 tuple (glow .point (lambda value : min (255 , int (value * c / 255 ))) for c in color ),
750715 )
751716
752- return _neon_blend (image , neon , alpha )
717+ return Image . blend (image , neon , alpha )
753718
754719
755720def invert (image : Image .Image ) -> Image .Image :
0 commit comments