Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #@gui _<b>Degradations</b>
- #@gui Sawtoother [CMYK] : sawtoother_cmyk, sawtoother_cmyk_preview(1)+
- #@gui : note = note("Splits image into CMYK channels and uses modulo operations to generate sawtooth waves and map channel intensities to them.")
- #@gui : note = note("<small>This filter was intended for screwing up images but it can also be used for quick analysis among other things.</small>"), sep = separator()
- #@gui : Cyan factor = float(1,0,20)
- #@gui : Cyan shift = float(0,-255,255)
- #@gui : Cyan smoothness = float(0,0,10)
- #@gui : Cyan modulo = bool(1)
- #@gui : Cyan multiplier = float(1,0,20)
- #@gui : Cyan phase shift = float(0,-255,255)
- #@gui : sep = separator()
- #@gui : Magenta factor = float(1,0,20)
- #@gui : Magenta shift = float(0,-255,255)
- #@gui : Magenta smoothness = float(0,0,10)
- #@gui : Magenta modulo = bool(1)
- #@gui : Magenta multiplier = float(1,0,20)
- #@gui : Magenta phase shift = float(0,-255,255)
- #@gui : sep = separator()
- #@gui : Yellow factor = float(1,0,20)
- #@gui : Yellow shift = float(0,-255,255)
- #@gui : Yellow smoothness = float(0,0,10)
- #@gui : Yellow modulo = bool(1)
- #@gui : Yellow multiplier = float(1,0,20)
- #@gui : Yellow phase shift = float(0,-255,255)
- #@gui : sep = separator()
- #@gui : Key factor = float(1,0,20)
- #@gui : Key shift = float(0,-255,255)
- #@gui : Key smoothness = float(0,0,10)
- #@gui : Key modulo = bool(1)
- #@gui : Key multiplier = float(1,0,20)
- #@gui : Key phase shift = float(0,-255,255)
- #@gui : sep = separator()
- #@gui : Tones range = choice("All tones","Shadows","Mid-tones","Highlights")
- #@gui : Tones smoothness = float(2,0,10)
- #@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right"))
- sawtoother_cmyk :
- repeat $! l. split_opacity rv to_rgb.
- fx_start_mix $25,$26
- rgb2cmyk. s. c
- if {$4} b[-4] $3% +[-4] $6 %[-4] {256/$1} *[-4] $1 %[-3] 256 *[-4] $5 +[-4] $2 else *[-4] $1 +[-4] {$2*$1} b[-4] $3% fi
- if {$10} b[-3] $9% +[-3] $12 %[-3] {256/$7} *[-3] $7 %[-3] 256 *[-3] $11 +[-3] $8 else *[-3] $7 +[-3] {$8*$7} b[-3] $9% fi
- if {$16} b[-2] $15% +[-2] $18 %[-2] {256/$13} *[-2] $13 %[-2] 256 *[-2] $17 +[-2] $14 else *[-2] $13 +[-2] {$14*$13} b[-2] $15% fi
- if {$22} b[-1] $21% +[-1] $24 %[-1] {256/$19} *[-1] $19 %[-1] 256 *[-1] $23 +[-1] $20 else *[-1] $19 +[-1] {$20*$19} b[-1] $21% fi
- a[-4--1] c cmyk2rgb.
- fx_end_mix $25
- if {$!!=3} rv a c fi endl mv. 0 done
- sawtoother_cmyk_preview :
- gui_split_preview "sawtoother_cmyk $*",$-1
- #@gui Sawtoother [HSV] : sawtoother_hsv, sawtoother_hsv_preview(1)+
- #@gui : note = note("Splits image into HSV channels and uses modulo operations to generate sawtooth waves and map channel intensities to them.")
- #@gui : note = note("<small>This filter was intended for screwing up images but it can also be used for quick analysis among other things.</small>"), sep = separator()
- #@gui : Hue factor = float(1,0,20)
- #@gui : Hue shift = float(0,-180,180)
- #@gui : Hue smoothness = float(0,0,10)
- #@gui : Hue modulo = bool(1)
- #@gui : Hue multiplier = float(1,0,20)
- #@gui : Hue phase shift = float(0,-180,180)
- #@gui : sep = separator()
- #@gui : Saturation factor = float(1,0,20)
- #@gui : Saturation shift = float(0,-1,1)
- #@gui : Saturation smoothness = float(0,0,10)
- #@gui : Saturation modulo = bool(1)
- #@gui : Saturation multiplier = float(1,0,20)
- #@gui : Saturation phase shift = float(0,-1,1)
- #@gui : sep = separator()
- #@gui : Value factor = float(1,0,20)
- #@gui : Value shift = float(0,-1,1)
- #@gui : Value smoothness = float(0,0,10)
- #@gui : Value modulo = bool(1)
- #@gui : Value multiplier = float(1,0,20)
- #@gui : Value phase shift = float(0,-1,1)
- #@gui : sep = separator()
- #@gui : Tones range = choice("All tones","Shadows","Mid-tones","Highlights")
- #@gui : Tones smoothness = float(2,0,10)
- #@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right")
- sawtoother_hsv :
- repeat $! l. split_opacity rv to_rgb.
- fx_start_mix $19,$20
- rgb2hsv. s. c -[-2,-1] 0.5
- +[-2,-1] 0.5
- if {$4} b[-3] $3% +[-3] $6 %[-3] {360/($1)^2} *[-3] $1 %[-3] 360 *[-3] {$5*$1} +[-3] {$2} else *[-3] $1 +[-3] {$2*$1} b[-3] $3% fi %[-3] 360
- if {$10} b[-2] $9% +[-2] $12 %[-2] {(1+(1/255))/$7} *[-2] {$7} %[-2] {(1+(1/255))} *[-2] $11 +[-2] {$8} else *[-2] $7 +[-2] {$8*$7} b[-2] $9% fi
- if {$16} b[-1] $15% +[-1] $18 %[-1] {(1+(1/255))/$13} *[-1] {$13} %[-1] {(1+(1/255))} *[-1] $17 +[-1] {$14} else *[-1] $13 +[-1] {$14*$13} b[-1] $15% fi
- c[-2,-1] 0,1 a[-3--1] c hsv2rgb.
- fx_end_mix $19
- if {$!!=3} rv a c fi endl mv. 0 done
- sawtoother_hsv_preview :
- gui_split_preview "sawtoother_hsv $*",$-1
- #@gui Sawtoother [RGB] : sawtoother_rgb, sawtoother_rgb_preview(1)+
- #@gui : note = note("Splits image into RGB channels and uses modulo operations to generate sawtooth waves and map channel intensities to them.")
- #@gui : note = note("<small>This filter was intended for screwing up images but it can also be used for quick analysis among other things.</small>"), sep = separator()
- #@gui : Red factor = float(1,0,20)
- #@gui : Red shift = float(0,-255,255)
- #@gui : Red smoothness = float(0,0,10)
- #@gui : Red modulo = bool(1)
- #@gui : Red multiplier = float(1,0,20)
- #@gui : Red phase shift = float(0,-255,255)
- #@gui : sep = separator()
- #@gui : Green factor = float(1,0,20)
- #@gui : Green shift = float(0,-255,255)
- #@gui : Green smoothness = float(0,0,10)
- #@gui : Green modulo = bool(1)
- #@gui : Green multiplier = float(1,0,20)
- #@gui : Green phase shift = float(0,-255,255)
- #@gui : sep = separator()
- #@gui : Blue factor = float(1,0,20)
- #@gui : Blue shift = float(0,-255,255)
- #@gui : Blue smoothness = float(0,0,10)
- #@gui : Blue modulo = bool(1)
- #@gui : Blue multiplier = float(1,0,20)
- #@gui : Blue phase shift = float(0,-255,255)
- #@gui : sep = separator()
- #@gui : Tones range = choice("All tones","Shadows","Mid-tones","Highlights")
- #@gui : Tones smoothness = float(2,0,10)
- #@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right"))
- fx_start_mix :
- if {$1==1} +tones. 3 +[-2,-1] b[-2,-1] $2% r[-2,-1] ... *. ... mv... $!
- elif {$1==2} +tones. 3 +[-3,-1] b[-2,-1] $2% r[-2,-1] ... *.. ... mv... $!
- elif {$1==3} +tones. 3 +[-3,-2] b[-2,-1] $2% r[-2,-1] ... *.. ... mv... $!
- fi
- fx_end_mix :
- if {$1==1} *[-3,-1] +[-2,-1]
- elif {$1==2} *[-2,-1] +[-2,-1]
- elif {$1==3} *[-2,-1] +[-2,-1]
- fi
- c 0,255
- sawtoother_rgb :
- repeat $! l. split_opacity rv to_rgb.
- fx_start_mix $19,$20
- s. c
- +[-2,-1] 0.5
- if {$4} b[-3] $3% +[-3] $6 %[-3] {256/$1} *[-3] $1 %[-3] 256 *[-3] $5 +[-3] $2 else *[-3] $1 +[-3] {$2*$1} b[-3] $3% fi
- if {$10} b[-2] $9% +[-2] $12 %[-2] {256/$7} *[-2] $7 %[-2] 256 *[-2] $11 +[-2] $8 else *[-2] $7 +[-2] {$8*$7} b[-2] $9% fi
- if {$16} b[-1] $15% +[-1] $18 %[-1] {256/$13} *[-1] $13 %[-1] 256 *[-1] $17 +[-1] $14 else *[-1] $13 +[-1] {$14*$13} b[-1] $15% fi
- a[-3--1] c +. 0 c. 0,255
- fx_end_mix $19
- if {$!!=3} rv a c fi endl mv. 0 done
- sawtoother_rgb_preview :
- gui_split_preview "sawtoother_rgb $*",$-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement