Advertisement
Guest User

Sawtoothers

a guest
Aug 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.15 KB | None | 0 0
  1. #@gui _<b>Degradations</b>
  2.  
  3. #@gui Sawtoother [CMYK] : sawtoother_cmyk, sawtoother_cmyk_preview(1)+
  4. #@gui : note = note("Splits image into CMYK channels and uses modulo operations to generate sawtooth waves and map channel intensities to them.")
  5. #@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()
  6. #@gui : Cyan factor = float(1,0,20)
  7. #@gui : Cyan shift = float(0,-255,255)
  8. #@gui : Cyan smoothness = float(0,0,10)
  9. #@gui : Cyan modulo = bool(1)
  10. #@gui : Cyan multiplier = float(1,0,20)
  11. #@gui : Cyan phase shift = float(0,-255,255)
  12. #@gui : sep = separator()
  13. #@gui : Magenta factor = float(1,0,20)
  14. #@gui : Magenta shift = float(0,-255,255)
  15. #@gui : Magenta smoothness = float(0,0,10)
  16. #@gui : Magenta modulo = bool(1)
  17. #@gui : Magenta multiplier = float(1,0,20)
  18. #@gui : Magenta phase shift = float(0,-255,255)
  19. #@gui : sep = separator()
  20. #@gui : Yellow factor = float(1,0,20)
  21. #@gui : Yellow shift = float(0,-255,255)
  22. #@gui : Yellow smoothness = float(0,0,10)
  23. #@gui : Yellow modulo = bool(1)
  24. #@gui : Yellow multiplier = float(1,0,20)
  25. #@gui : Yellow phase shift = float(0,-255,255)
  26. #@gui : sep = separator()
  27. #@gui : Key factor = float(1,0,20)
  28. #@gui : Key shift = float(0,-255,255)
  29. #@gui : Key smoothness = float(0,0,10)
  30. #@gui : Key modulo = bool(1)
  31. #@gui : Key multiplier = float(1,0,20)
  32. #@gui : Key phase shift = float(0,-255,255)
  33. #@gui : sep = separator()
  34. #@gui : Tones range = choice("All tones","Shadows","Mid-tones","Highlights")
  35. #@gui : Tones smoothness = float(2,0,10)
  36. #@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right"))
  37. sawtoother_cmyk :
  38. repeat $! l. split_opacity rv to_rgb.
  39. fx_start_mix $25,$26
  40. rgb2cmyk. s. c
  41. 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
  42. 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
  43. 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
  44. 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
  45. a[-4--1] c cmyk2rgb.
  46. fx_end_mix $25
  47. if {$!!=3} rv a c fi endl mv. 0 done
  48. sawtoother_cmyk_preview :
  49. gui_split_preview "sawtoother_cmyk $*",$-1
  50.  
  51. #@gui Sawtoother [HSV] : sawtoother_hsv, sawtoother_hsv_preview(1)+
  52. #@gui : note = note("Splits image into HSV channels and uses modulo operations to generate sawtooth waves and map channel intensities to them.")
  53. #@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()
  54. #@gui : Hue factor = float(1,0,20)
  55. #@gui : Hue shift = float(0,-180,180)
  56. #@gui : Hue smoothness = float(0,0,10)
  57. #@gui : Hue modulo = bool(1)
  58. #@gui : Hue multiplier = float(1,0,20)
  59. #@gui : Hue phase shift = float(0,-180,180)
  60. #@gui : sep = separator()
  61. #@gui : Saturation factor = float(1,0,20)
  62. #@gui : Saturation shift = float(0,-1,1)
  63. #@gui : Saturation smoothness = float(0,0,10)
  64. #@gui : Saturation modulo = bool(1)
  65. #@gui : Saturation multiplier = float(1,0,20)
  66. #@gui : Saturation phase shift = float(0,-1,1)
  67. #@gui : sep = separator()
  68. #@gui : Value factor = float(1,0,20)
  69. #@gui : Value shift = float(0,-1,1)
  70. #@gui : Value smoothness = float(0,0,10)
  71. #@gui : Value modulo = bool(1)
  72. #@gui : Value multiplier = float(1,0,20)
  73. #@gui : Value phase shift = float(0,-1,1)
  74. #@gui : sep = separator()
  75. #@gui : Tones range = choice("All tones","Shadows","Mid-tones","Highlights")
  76. #@gui : Tones smoothness = float(2,0,10)
  77. #@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right")
  78. sawtoother_hsv :
  79. repeat $! l. split_opacity rv to_rgb.
  80. fx_start_mix $19,$20
  81. rgb2hsv. s. c -[-2,-1] 0.5
  82. +[-2,-1] 0.5
  83. 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
  84. 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
  85. 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
  86. c[-2,-1] 0,1 a[-3--1] c hsv2rgb.
  87. fx_end_mix $19
  88. if {$!!=3} rv a c fi endl mv. 0 done
  89. sawtoother_hsv_preview :
  90. gui_split_preview "sawtoother_hsv $*",$-1
  91.  
  92. #@gui Sawtoother [RGB] : sawtoother_rgb, sawtoother_rgb_preview(1)+
  93. #@gui : note = note("Splits image into RGB channels and uses modulo operations to generate sawtooth waves and map channel intensities to them.")
  94. #@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()
  95. #@gui : Red factor = float(1,0,20)
  96. #@gui : Red shift = float(0,-255,255)
  97. #@gui : Red smoothness = float(0,0,10)
  98. #@gui : Red modulo = bool(1)
  99. #@gui : Red multiplier = float(1,0,20)
  100. #@gui : Red phase shift = float(0,-255,255)
  101. #@gui : sep = separator()
  102. #@gui : Green factor = float(1,0,20)
  103. #@gui : Green shift = float(0,-255,255)
  104. #@gui : Green smoothness = float(0,0,10)
  105. #@gui : Green modulo = bool(1)
  106. #@gui : Green multiplier = float(1,0,20)
  107. #@gui : Green phase shift = float(0,-255,255)
  108. #@gui : sep = separator()
  109. #@gui : Blue factor = float(1,0,20)
  110. #@gui : Blue shift = float(0,-255,255)
  111. #@gui : Blue smoothness = float(0,0,10)
  112. #@gui : Blue modulo = bool(1)
  113. #@gui : Blue multiplier = float(1,0,20)
  114. #@gui : Blue phase shift = float(0,-255,255)
  115. #@gui : sep = separator()
  116. #@gui : Tones range = choice("All tones","Shadows","Mid-tones","Highlights")
  117. #@gui : Tones smoothness = float(2,0,10)
  118. #@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right"))
  119. fx_start_mix :
  120. if {$1==1} +tones. 3 +[-2,-1] b[-2,-1] $2% r[-2,-1] ... *. ... mv... $!
  121. elif {$1==2} +tones. 3 +[-3,-1] b[-2,-1] $2% r[-2,-1] ... *.. ... mv... $!
  122. elif {$1==3} +tones. 3 +[-3,-2] b[-2,-1] $2% r[-2,-1] ... *.. ... mv... $!
  123. fi
  124. fx_end_mix :
  125. if {$1==1} *[-3,-1] +[-2,-1]
  126. elif {$1==2} *[-2,-1] +[-2,-1]
  127. elif {$1==3} *[-2,-1] +[-2,-1]
  128. fi
  129. c 0,255
  130. sawtoother_rgb :
  131. repeat $! l. split_opacity rv to_rgb.
  132. fx_start_mix $19,$20
  133. s. c
  134. +[-2,-1] 0.5
  135. 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
  136. 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
  137. 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
  138. a[-3--1] c +. 0 c. 0,255
  139. fx_end_mix $19
  140. if {$!!=3} rv a c fi endl mv. 0 done
  141. sawtoother_rgb_preview :
  142. gui_split_preview "sawtoother_rgb $*",$-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement