@@ -999,6 +999,7 @@ def INPUT_TYPES(s):
999999 "max" : 1.0 ,
10001000 "step" : 0.1
10011001 }),
1002+ "mode" : (["sepia" , "blue-pia" , "green-pia" ],),
10021003 },
10031004 }
10041005
@@ -1007,12 +1008,18 @@ def INPUT_TYPES(s):
10071008
10081009 CATEGORY = "postprocessing/Color Adjustments"
10091010
1010- def sepia (self , image : torch .Tensor , strength : float ):
1011+ def sepia (self , image : torch .Tensor , strength : float , mode : str = "sepia" ):
10111012 if strength == 0 :
10121013 return (image ,)
10131014
10141015 sepia_weights = torch .tensor ([0.2989 , 0.5870 , 0.1140 ]).view (1 , 1 , 1 , 3 ).to (image .device )
1015- sepia_filter = torch .tensor ([1.0 , 0.8 , 0.6 ]).view (1 , 1 , 1 , 3 ).to (image .device )
1016+
1017+ if mode == "sepia" :
1018+ sepia_filter = torch .tensor ([1.0 , 0.8 , 0.6 ]).view (1 , 1 , 1 , 3 ).to (image .device )
1019+ elif mode == "blue-pia" :
1020+ sepia_filter = torch .tensor ([0.6 , 0.8 , 1.0 ]).view (1 , 1 , 1 , 3 ).to (image .device )
1021+ elif mode == "green-pia" :
1022+ sepia_filter = torch .tensor ([0.6 , 1.0 , 0.6 ]).view (1 , 1 , 1 , 3 ).to (image .device )
10161023
10171024 grayscale = torch .sum (image * sepia_weights , dim = - 1 , keepdim = True )
10181025 sepia = grayscale * sepia_filter
0 commit comments