#! C:/Program Files/Nuke6.1v1/Nuke6.1.exe -nx
version 6.1 v1
Gizmo {
 inputs 2
 help "Advanced Grain Gizmo by Andreas Frickinger\n\nAdds funcionality to the standard Nuke Grain Node to cope all aspects for matching film grain.\n\nIntensity over luminance: Use the red, green and blue curve to adjust how much grain shoudl be put in certain brightness levels in the channels.\n\nBlur or sharpen the grain seperately in the different channels, or adjust the saturation of the grain."
 addUserKnob {20 Grain}
 addUserKnob {26 title l "" +STARTLINE T "Advanced Grain by Andreas Frickinger"}
 addUserKnob {26 ""}
 addUserKnob {41 output T ControlGizmo.output}
 addUserKnob {26 ""}
 addUserKnob {41 seed l seed/preset T Grain2_1.seed}
 addUserKnob {41 presets l "" -STARTLINE T Grain2_1.presets}
 addUserKnob {26 spacer3 l " " T " "}
 addUserKnob {26 "" l "@b;Size"}
 addUserKnob {41 red_size l red T Grain2_1.red_size}
 addUserKnob {41 green_size l green T Grain2_1.green_size}
 addUserKnob {41 blue_size l blue T Grain2_1.blue_size}
 addUserKnob {26 "" l "@b;Irregularity"}
 addUserKnob {41 red_i l red T Grain2_1.red_i}
 addUserKnob {41 green_i l green T Grain2_1.green_i}
 addUserKnob {41 blue_i l blue T Grain2_1.blue_i}
 addUserKnob {26 "" l "@b;Intensity"}
 addUserKnob {41 red_m l red T Grain2_1.red_m}
 addUserKnob {41 green_m l green T Grain2_1.green_m}
 addUserKnob {41 blue_m l blue T Grain2_1.blue_m}
 addUserKnob {41 black_1 l black T Grain2_1.black}
 addUserKnob {26 ""}
 addUserKnob {26 intensity l "@b;Film Response" T "(use ONLY rgb to adjust, leave Master untouched!)"}
 addUserKnob {26 spacer5 l "  " T "  "}
 addUserKnob {41 lut l "" +STARTLINE T ColorLookupKey.lut}
 addUserKnob {20 advancedSettings l "Advanced Settings"}
 addUserKnob {26 blur l "@b;Blur"}
 addUserKnob {41 size l red T BlurRed.size}
 addUserKnob {41 size_1 l green T BlurGreen.size}
 addUserKnob {41 size_2 l blue T BlurBlue.size}
 addUserKnob {26 sharpen l "@b;Sharpen"}
 addUserKnob {41 amount_2 l red T SharpenRed.amount}
 addUserKnob {41 amount_1 l green T SharpenGreen.amount}
 addUserKnob {41 amount l blue T SharpenBlue.amount}
 addUserKnob {26 ""}
 addUserKnob {41 saturation l Saturation T SaturationGrain.saturation}
 addUserKnob {26 spacer l " " T " "}
 addUserKnob {26 lin2log l "@b;LinLog/LogLin"}
 addUserKnob {41 disable_1 l disable T Lin2Log_in.disable}
 addUserKnob {41 black T Lin2Log_in.black}
 addUserKnob {41 white T Lin2Log_in.white}
 addUserKnob {41 gamma T Lin2Log_in.gamma}
 addUserKnob {26 ""}
 addUserKnob {41 maskChannel l Mask +INVISIBLE T MergeMaskl.maskChannel}
 addUserKnob {41 maskFrom l from +INVISIBLE T MergeMaskl.maskFrom}
 addUserKnob {41 invertMask l "invert mask" T ControlGizmo.invertMask}
 addUserKnob {41 which l mix T MixOrig.which}
 addUserKnob {41 alpha l "(un)premult by" T Unpremult1.alpha}
}
 Input {
  inputs 0
  name Image
  xpos -147
  ypos -288
 }
 Dot {
  name Dot2
  xpos -113
  ypos 139
 }
set N93df610 [stack 0]
 Dot {
  name Dot6
  xpos -470
  ypos 139
 }
set N93e3300 [stack 0]
 ColorLookup {
  channels rgb
  lut {master {}
    red {curve C 0.6 x0.75 0.17 x1 0.07}
    green {curve C 0.6 x0.75 0.17 x1 0.07}
    blue {curve C 0.7 x0.75 0.2 x1 0.1}
    alpha {}}
  name ColorLookupKey
  xpos -744
  ypos 135
 }
 Shuffle {
  alpha black
  name Shuffle4
  xpos -744
  ypos 230
 }
set N93e37e0 [stack 0]
 Dot {
  name Dot13
  xpos -848
  ypos 234
 }
set N90b2570 [stack 0]
 Dot {
  name Dot15
  xpos -1088
  ypos 234
 }
 Dot {
  name Dot14
  xpos -1088
  ypos 497
 }
push $N93e3300
 Dot {
  name Dot9
  xpos -470
  ypos 365
 }
 Expression {
  expr0 0.18
  expr1 0.18
  expr2 0.18
  expr3 0
  name Expression2
  xpos -678
  ypos 361
 }
 Shuffle {
  alpha white
  name Shuffle2
  xpos -678
  ypos 426
 }
set N90b1940 [stack 0]
 Dot {
  name Dot1
  xpos -747
  ypos 430
 }
set N90b58a0 [stack 0]
 Dot {
  name Dot11
  xpos -924
  ypos 430
 }
set N90b5630 [stack 0]
 Dot {
  name Dot16
  xpos -1191
  ypos 430
 }
 Copy {
  inputs 2
  from0 rgba.blue
  to0 rgba.alpha
  name Copy3
  xpos -1225
  ypos 487
 }
 Group {
  name Grain2_3
  help "Adds synthetic grain. Push \"presets\" to get predefined types of grain, these are the correct size for 2K scans.\n\nYou can also adjust the sliders to match a sample piece of grain. Find a sample with a rather constant background, blur it to remove the grain, and use as input to this. View with a wipe in the viewer so you can make a match. It helps to view and match each of the red, green, blue separately."
  label "Kodak 5248"
  xpos -1225
  ypos 544
  addUserKnob {20 "" l User}
  addUserKnob {3 seed t "Change this value to make different instances of this operator produce different noise"}
  seed 134
  addUserKnob {35 presets l "" -STARTLINE M {"presets/Kodak 5248" "knobs this \{red_size 3.30 green_size 2.90 blue_size 2.5 red_i 0.60 green_i 0.60 blue_i 0.60 red_m 0.42 green_m 0.46 blue_m 0.85 black 0.00 label \{Kodak 5248\}\}" "presets/Kodak 5279" "knobs this \{red_size 2.70 green_size 2.60 blue_size 2.40 red_i 1.00 green_i 0.76 blue_i 0.65 red_m 0.37 green_m 0.60 blue_m 1.65 black 0.00 label \{Kodak 5279\}\}" "presets/Kodak FX214" "knobs this \{red_size 1.87 green_size 2.60 blue_size 2.44 red_i 1 green_i 0.76 blue_i 0.79 red_m 0.41 green_m 0.60 blue_m 1.80 black 0.00 label \{Kodak FX214\}\}" "presets/Kodak GT5274" "knobs this \{red_size 0.04 green_size 0.10 blue_size 0.90 red_i 0.90 green_i 0.76 blue_i 0.81 red_m 0.49 green_m 0.50 blue_m 1.55 black 0.00 label \{Kodak GT5274\}\}" "presets/Kodak 5217" "knobs this \{red_size 0.23 green_size 1.20 blue_size 1.40 red_i 0.60 green_i 0.86 blue_i 0.60 red_m 0.48 green_m 0.42 blue_m 0.87 black 0.00 label \{Kodak 5217\}\}" "presets/Kodak 5218" "knobs this \{red_size 0.10 green_size 1.60 blue_size 1.91 red_i 0.60 green_i 0.86 blue_i 0.73 red_m 0.38 green_m 0.17 blue_m 0.87 black 0.00 label \{Kodak 5218\}\}" presets/other "knobs this \{label other\}"}}
  addUserKnob {26 "" l "@b;Size"}
  addUserKnob {14 red_size l red R 0 100}
  red_size {{parent.Grain2_1.red_size.main i}}
  addUserKnob {14 green_size l green R 0 100}
  green_size {{parent.Grain2_1.green_size.main i}}
  addUserKnob {14 blue_size l blue R 0 100}
  blue_size {{parent.Grain2_1.blue_size.main i}}
  addUserKnob {26 "" l "@b;Irregularity"}
  addUserKnob {7 red_i l red}
  red_i {{parent.Grain2_1.red_i.main i}}
  addUserKnob {7 green_i l green}
  green_i {{parent.Grain2_1.green_i.main i}}
  addUserKnob {7 blue_i l blue}
  blue_i {{parent.Grain2_1.blue_i.main i}}
  addUserKnob {26 "" l "@b;Intensity"}
  addUserKnob {7 red_m l red t "Amount of grain to add to a white pixel"}
  red_m {{parent.Grain2_1.red_m.main i}}
  addUserKnob {7 green_m l green}
  green_m {{parent.Grain2_1.green_m.main i}}
  addUserKnob {7 blue_m l blue}
  blue_m {{parent.Grain2_1.blue_m.main i}}
  addUserKnob {18 black t "Amount of grain to add everywhere"}
  black {{parent.Grain2_1.black i} {parent.Grain2_1.black i} {parent.Grain2_1.black i}}
  addUserKnob {18 minimum t "Minimum black level" R 0 0.01}
  minimum {{parent.Grain2_1.minimum i} {parent.Grain2_1.minimum i} {parent.Grain2_1.minimum i}}
  addUserKnob {26 "" l "@b;Mask"}
  addUserKnob {6 maskgrain l "Apply only through alpha" -STARTLINE}
  maskgrain true
  addUserKnob {41 maskinvert l "Invert alpha" -STARTLINE T Copy1.invert_mask}
 }
  Input {
   inputs 0
   name Input1
   xpos 0
  }
set N90b4a00 [stack 0]
  Noise {
   output {rgba.red -rgba.green -rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.red_size.w} {parent.red_size.h}}
   zoffset {{frame+seed+red_i/2}}
   octaves 2
   gamma 1
   xrotate {{red_i*45}}
   yrotate {{red_i*45}}
   name red
   xpos 220
  }
  Noise {
   output {-rgba.red rgba.green -rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.green_size.w} {parent.green_size.h}}
   zoffset {{frame+2*seed+green_i/2}}
   octaves 2
   gamma 1
   xrotate {{green_i*45}}
   yrotate {{green_i*45}}
   name green
   xpos 220
   ypos 43
  }
  Noise {
   output {-rgba.red -rgba.green rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.blue_size.w} {parent.blue_size.h}}
   zoffset {{frame+3*seed+blue_i/2}}
   octaves 2
   gamma 1
   xrotate {{blue_i*45}}
   yrotate {{blue_i*45}}
   name blue
   xpos 220
   ypos 86
  }
push $N90b4a00
  MergeExpression {
   inputs 2
   expr0 max(minimum.r,r+(2*Ar-1)*(r*red_m+black.r))
   expr1 max(minimum.g,g+(2*Ag-1)*(g*green_m+black.g))
   expr2 max(minimum.b,b+(2*Ab-1)*(b*blue_m+black.b))
   name MergeExpression1
   xpos 220
   ypos 168
  }
set N90bf720 [stack 0]
push $N90b4a00
  Copy {
   inputs 2
   channels rgb
   maskChannelInput rgba.alpha
   name Copy1
   xpos 0
   ypos 154
  }
push $N90bf720
  Switch {
   inputs 2
   which {{maskgrain}}
   name Switch1
   selected true
   xpos 0
   ypos 241
  }
  Output {
   name Output1
   xpos 0
   ypos 286
  }
 end_group
 Dot {
  name Dot18
  xpos -1191
  ypos 688
 }
set N90c00e0 [stack 0]
 Shuffle {
  red alpha
  green alpha
  blue alpha
  name Shuffle1
  xpos -1225
  ypos 1199
 }
 Dot {
  name Dot22
  label blue
  xpos -1191
  ypos 1355
 }
push $N90b2570
 Dot {
  name Dot12
  xpos -848
  ypos 497
 }
push $N90b5630
 Copy {
  inputs 2
  from0 rgba.green
  to0 rgba.alpha
  name Copy1
  xpos -958
  ypos 487
 }
 Group {
  name Grain2_2
  help "Adds synthetic grain. Push \"presets\" to get predefined types of grain, these are the correct size for 2K scans.\n\nYou can also adjust the sliders to match a sample piece of grain. Find a sample with a rather constant background, blur it to remove the grain, and use as input to this. View with a wipe in the viewer so you can make a match. It helps to view and match each of the red, green, blue separately."
  label "Kodak 5248"
  xpos -958
  ypos 544
  addUserKnob {20 "" l User}
  addUserKnob {3 seed t "Change this value to make different instances of this operator produce different noise"}
  seed 134
  addUserKnob {35 presets l "" -STARTLINE M {"presets/Kodak 5248" "knobs this \{red_size 3.30 green_size 2.90 blue_size 2.5 red_i 0.60 green_i 0.60 blue_i 0.60 red_m 0.42 green_m 0.46 blue_m 0.85 black 0.00 label \{Kodak 5248\}\}" "presets/Kodak 5279" "knobs this \{red_size 2.70 green_size 2.60 blue_size 2.40 red_i 1.00 green_i 0.76 blue_i 0.65 red_m 0.37 green_m 0.60 blue_m 1.65 black 0.00 label \{Kodak 5279\}\}" "presets/Kodak FX214" "knobs this \{red_size 1.87 green_size 2.60 blue_size 2.44 red_i 1 green_i 0.76 blue_i 0.79 red_m 0.41 green_m 0.60 blue_m 1.80 black 0.00 label \{Kodak FX214\}\}" "presets/Kodak GT5274" "knobs this \{red_size 0.04 green_size 0.10 blue_size 0.90 red_i 0.90 green_i 0.76 blue_i 0.81 red_m 0.49 green_m 0.50 blue_m 1.55 black 0.00 label \{Kodak GT5274\}\}" "presets/Kodak 5217" "knobs this \{red_size 0.23 green_size 1.20 blue_size 1.40 red_i 0.60 green_i 0.86 blue_i 0.60 red_m 0.48 green_m 0.42 blue_m 0.87 black 0.00 label \{Kodak 5217\}\}" "presets/Kodak 5218" "knobs this \{red_size 0.10 green_size 1.60 blue_size 1.91 red_i 0.60 green_i 0.86 blue_i 0.73 red_m 0.38 green_m 0.17 blue_m 0.87 black 0.00 label \{Kodak 5218\}\}" presets/other "knobs this \{label other\}"}}
  addUserKnob {26 "" l "@b;Size"}
  addUserKnob {14 red_size l red R 0 100}
  red_size {{parent.Grain2_1.red_size.main i}}
  addUserKnob {14 green_size l green R 0 100}
  green_size {{parent.Grain2_1.green_size.main i}}
  addUserKnob {14 blue_size l blue R 0 100}
  blue_size {{parent.Grain2_1.blue_size.main i}}
  addUserKnob {26 "" l "@b;Irregularity"}
  addUserKnob {7 red_i l red}
  red_i {{parent.Grain2_1.red_i.main i}}
  addUserKnob {7 green_i l green}
  green_i {{parent.Grain2_1.green_i.main i}}
  addUserKnob {7 blue_i l blue}
  blue_i {{parent.Grain2_1.blue_i.main i}}
  addUserKnob {26 "" l "@b;Intensity"}
  addUserKnob {7 red_m l red t "Amount of grain to add to a white pixel"}
  red_m {{parent.Grain2_1.red_m.main i}}
  addUserKnob {7 green_m l green}
  green_m {{parent.Grain2_1.green_m.main i}}
  addUserKnob {7 blue_m l blue}
  blue_m {{parent.Grain2_1.blue_m.main i}}
  addUserKnob {18 black t "Amount of grain to add everywhere"}
  black {{parent.Grain2_1.black i} {parent.Grain2_1.black i} {parent.Grain2_1.black i}}
  addUserKnob {18 minimum t "Minimum black level" R 0 0.01}
  minimum {{parent.Grain2_1.minimum i} {parent.Grain2_1.minimum i} {parent.Grain2_1.minimum i}}
  addUserKnob {26 "" l "@b;Mask"}
  addUserKnob {6 maskgrain l "Apply only through alpha" -STARTLINE}
  maskgrain true
  addUserKnob {41 maskinvert l "Invert alpha" -STARTLINE T Copy1.invert_mask}
 }
  Input {
   inputs 0
   name Input1
   xpos 0
  }
set N90c27e0 [stack 0]
  Noise {
   output {rgba.red -rgba.green -rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.red_size.w} {parent.red_size.h}}
   zoffset {{frame+seed+red_i/2}}
   octaves 2
   gamma 1
   xrotate {{red_i*45}}
   yrotate {{red_i*45}}
   name red
   xpos 220
  }
  Noise {
   output {-rgba.red rgba.green -rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.green_size.w} {parent.green_size.h}}
   zoffset {{frame+2*seed+green_i/2}}
   octaves 2
   gamma 1
   xrotate {{green_i*45}}
   yrotate {{green_i*45}}
   name green
   xpos 220
   ypos 43
  }
  Noise {
   output {-rgba.red -rgba.green rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.blue_size.w} {parent.blue_size.h}}
   zoffset {{frame+3*seed+blue_i/2}}
   octaves 2
   gamma 1
   xrotate {{blue_i*45}}
   yrotate {{blue_i*45}}
   name blue
   xpos 220
   ypos 86
  }
push $N90c27e0
  MergeExpression {
   inputs 2
   expr0 max(minimum.r,r+(2*Ar-1)*(r*red_m+black.r))
   expr1 max(minimum.g,g+(2*Ag-1)*(g*green_m+black.g))
   expr2 max(minimum.b,b+(2*Ab-1)*(b*blue_m+black.b))
   name MergeExpression1
   xpos 220
   ypos 168
  }
set N7cedde0 [stack 0]
push $N90c27e0
  Copy {
   inputs 2
   channels rgb
   maskChannelInput rgba.alpha
   name Copy1
   xpos 0
   ypos 154
  }
push $N7cedde0
  Switch {
   inputs 2
   which {{maskgrain}}
   name Switch1
   selected true
   xpos 0
   ypos 241
  }
  Output {
   name Output1
   xpos 0
   ypos 286
  }
 end_group
 Dot {
  name Dot17
  xpos -924
  ypos 631
 }
set N7cee7a0 [stack 0]
 Shuffle {
  red alpha
  green alpha
  blue alpha
  name Shuffle5
  xpos -964
  ypos 1199
 }
 Dot {
  name Dot21
  label green
  xpos -930
  ypos 1355
 }
push $N93e37e0
 Dot {
  name Dot4
  xpos -710
  ypos 497
 }
push $N90b1940
 Copy {
  inputs 2
  from0 rgba.red
  to0 rgba.alpha
  name Copy5
  xpos -678
  ypos 487
 }
set N94570a0 [stack 0]
 Group {
  name Grain2_1
  help "Adds synthetic grain. Push \"presets\" to get predefined types of grain, these are the correct size for 2K scans.\n\nYou can also adjust the sliders to match a sample piece of grain. Find a sample with a rather constant background, blur it to remove the grain, and use as input to this. View with a wipe in the viewer so you can make a match. It helps to view and match each of the red, green, blue separately."
  label "Kodak 5248"
  xpos -678
  ypos 542
  addUserKnob {20 "" l User}
  addUserKnob {3 seed t "Change this value to make different instances of this operator produce different noise"}
  seed 134
  addUserKnob {35 presets l "" -STARTLINE M {"presets/Kodak 5248" "knobs this \{red_size 3.30 green_size 2.90 blue_size 2.5 red_i 0.60 green_i 0.60 blue_i 0.60 red_m 0.42 green_m 0.46 blue_m 0.85 black 0.00 label \{Kodak 5248\}\}" "presets/Kodak 5279" "knobs this \{red_size 2.70 green_size 2.60 blue_size 2.40 red_i 1.00 green_i 0.76 blue_i 0.65 red_m 0.37 green_m 0.60 blue_m 1.65 black 0.00 label \{Kodak 5279\}\}" "presets/Kodak FX214" "knobs this \{red_size 1.87 green_size 2.60 blue_size 2.44 red_i 1 green_i 0.76 blue_i 0.79 red_m 0.41 green_m 0.60 blue_m 1.80 black 0.00 label \{Kodak FX214\}\}" "presets/Kodak GT5274" "knobs this \{red_size 0.04 green_size 0.10 blue_size 0.90 red_i 0.90 green_i 0.76 blue_i 0.81 red_m 0.49 green_m 0.50 blue_m 1.55 black 0.00 label \{Kodak GT5274\}\}" "presets/Kodak 5217" "knobs this \{red_size 0.23 green_size 1.20 blue_size 1.40 red_i 0.60 green_i 0.86 blue_i 0.60 red_m 0.48 green_m 0.42 blue_m 0.87 black 0.00 label \{Kodak 5217\}\}" "presets/Kodak 5218" "knobs this \{red_size 0.10 green_size 1.60 blue_size 1.91 red_i 0.60 green_i 0.86 blue_i 0.73 red_m 0.38 green_m 0.17 blue_m 0.87 black 0.00 label \{Kodak 5218\}\}" presets/other "knobs this \{label other\}"}}
  addUserKnob {26 "" l "@b;Size"}
  addUserKnob {14 red_size l red R 0 100}
  red_size 3.3
  addUserKnob {14 green_size l green R 0 100}
  green_size 2.9
  addUserKnob {14 blue_size l blue R 0 100}
  blue_size 2.5
  addUserKnob {26 "" l "@b;Irregularity"}
  addUserKnob {7 red_i l red}
  red_i 0.6
  addUserKnob {7 green_i l green}
  green_i 0.6
  addUserKnob {7 blue_i l blue}
  blue_i 0.6
  addUserKnob {26 "" l "@b;Intensity"}
  addUserKnob {7 red_m l red t "Amount of grain to add to a white pixel"}
  red_m 0.42
  addUserKnob {7 green_m l green}
  green_m 0.46
  addUserKnob {7 blue_m l blue}
  blue_m 0.85
  addUserKnob {18 black t "Amount of grain to add everywhere"}
  black 0.01
  addUserKnob {18 minimum t "Minimum black level" R 0 0.01}
  minimum {0 0 0}
  addUserKnob {26 "" l "@b;Mask"}
  addUserKnob {6 maskgrain l "Apply only through alpha" -STARTLINE}
  maskgrain true
  addUserKnob {41 maskinvert l "Invert alpha" -STARTLINE T Copy1.invert_mask}
 }
  Input {
   inputs 0
   name Input1
   xpos 0
  }
set N94577f0 [stack 0]
  Noise {
   output {rgba.red -rgba.green -rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.red_size.w} {parent.red_size.h}}
   zoffset {{frame+seed+red_i/2}}
   octaves 2
   gamma 1
   xrotate {{red_i*45}}
   yrotate {{red_i*45}}
   name red
   xpos 220
  }
  Noise {
   output {-rgba.red rgba.green -rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.green_size.w} {parent.green_size.h}}
   zoffset {{frame+2*seed+green_i/2}}
   octaves 2
   gamma 1
   xrotate {{green_i*45}}
   yrotate {{green_i*45}}
   name green
   xpos 220
   ypos 43
  }
  Noise {
   output {-rgba.red -rgba.green rgba.blue -rgba.alpha}
   cliptype none
   replace true
   size {{parent.blue_size.w} {parent.blue_size.h}}
   zoffset {{frame+3*seed+blue_i/2}}
   octaves 2
   gamma 1
   xrotate {{blue_i*45}}
   yrotate {{blue_i*45}}
   name blue
   xpos 220
   ypos 86
  }
push $N94577f0
  MergeExpression {
   inputs 2
   expr0 max(minimum.r,r+(2*Ar-1)*(r*red_m+black.r))
   expr1 max(minimum.g,g+(2*Ag-1)*(g*green_m+black.g))
   expr2 max(minimum.b,b+(2*Ab-1)*(b*blue_m+black.b))
   name MergeExpression1
   xpos 220
   ypos 168
  }
set N94597a0 [stack 0]
push $N94577f0
  Copy {
   inputs 2
   channels rgb
   maskChannelInput rgba.alpha
   name Copy1
   xpos 0
   ypos 154
  }
push $N94597a0
  Switch {
   inputs 2
   which {{maskgrain}}
   name Switch1
   selected true
   xpos 0
   ypos 241
  }
  Output {
   name Output1
   xpos 0
   ypos 286
  }
 end_group
set N7c2ba70 [stack 0]
 Dot {
  name Dot19
  xpos -800
  ypos 552
 }
 Shuffle {
  red alpha
  green alpha
  blue alpha
  name Shuffle6
  xpos -834
  ypos 1199
 }
 Dot {
  name Dot20
  label red
  xpos -800
  ypos 1355
 }
push $N93df610
 Expression {
  channel0 {-rgba.red -rgba.green -rgba.blue}
  channel1 {-rgba.red -rgba.green -rgba.blue}
  channel2 {-rgba.red -rgba.green -rgba.blue}
  expr3 a==0?0:a
  name Expression3
  xpos -147
  ypos 807
 }
 Unpremult {
  alpha -rgba.alpha
  name Unpremult1
  xpos -147
  ypos 866
  disable {{alpha==0?1:0 i x163 0}}
 }
set N945c110 [stack 0]
 Dot {
  name Dot3
  xpos -4
  ypos 870
 }
 Dot {
  name Dot10
  xpos -4
  ypos 1311
 }
 Input {
  inputs 0
  name Mask
  xpos -377
  ypos 502
  number 1
 }
 Invert {
  name Invert1
  xpos -377
  ypos 647
  disable {{ControlGizmo.invertMask i}}
 }
 Expression {
  expr0 r==0?0:r
  expr1 g==0?0:g
  expr2 b==0?0:b
  expr3 a==0?0:a
  name Expression4
  xpos -377
  ypos 698
 }
 Invert {
  name Invert2
  xpos -377
  ypos 735
 }
push $N90b58a0
 Dot {
  name Dot5
  xpos -747
  ypos 745
 }
push $N90c00e0
push $N7cee7a0
push $N7c2ba70
 Copy {
  inputs 2
  from0 rgba.green
  to0 rgba.green
  name Copy4
  xpos -678
  ypos 621
 }
 Copy {
  inputs 2
  from0 rgba.blue
  to0 rgba.blue
  name Copy6
  xpos -678
  ypos 678
 }
 Merge2 {
  inputs 2+1
  invert_mask true
  name MergeMaskl
  xpos -678
  ypos 741
 }
set N945dbe0 [stack 0]
 Shuffle {
  alpha white
  name Shuffle3
  xpos -678
  ypos 792
 }
 Blur {
  channels {rgba.red -rgba.green -rgba.blue}
  name BlurRed
  xpos -678
  ypos 850
 }
 Blur {
  channels {-rgba.red rgba.green -rgba.blue}
  name BlurGreen
  xpos -678
  ypos 885
 }
 Blur {
  channels {-rgba.red -rgba.green rgba.blue}
  name BlurBlue
  xpos -678
  ypos 920
 }
 Sharpen {
  channels {rgba.red -rgba.green -rgba.blue}
  amount 0
  name SharpenRed
  xpos -678
  ypos 994
 }
 Sharpen {
  channels {-rgba.red rgba.green -rgba.blue}
  amount 0
  name SharpenGreen
  xpos -678
  ypos 1033
 }
 Sharpen {
  channels {-rgba.red -rgba.green rgba.blue}
  amount 0
  name SharpenBlue
  xpos -678
  ypos 1072
 }
 Saturation {
  name SaturationGrain
  xpos -678
  ypos 1138
 }
push $N945c110
 Log2Lin {
  operation lin2log
  name Lin2Log_in
  xpos -147
  ypos 976
 }
 Merge2 {
  inputs 2
  operation multiply
  name Merge13
  xpos -147
  ypos 1138
 }
push $N94570a0
 Dot {
  name Dot7
  xpos -560
  ypos 497
 }
 Dot {
  name Dot8
  xpos -560
  ypos 1254
 }
 Merge2 {
  inputs 2
  operation divide
  name Merge14
  xpos -147
  ypos 1250
 }
 Copy {
  inputs 2
  from0 rgba.alpha
  to0 rgba.alpha
  name Copy2
  xpos -147
  ypos 1301
 }
 Log2Lin {
  black {{parent.Lin2Log_in.black i}}
  white {{parent.Lin2Log_in.white i}}
  gamma {{parent.Lin2Log_in.gamma i}}
  name Log2Lin_out
  xpos -147
  ypos 1353
  disable {{Lin2Log_in.disable i}}
 }
 Premult {
  name Premult1
  xpos -147
  ypos 1390
  disable {{Unpremult1.disable}}
 }
push $N93df610
 Dot {
  name Dot24
  xpos 254
  ypos 139
 }
 Dot {
  name Dot23
  xpos 254
  ypos 1479
 }
 Dissolve {
  inputs 2
  which 1
  name MixOrig
  xpos -147
  ypos 1469
 }
 Switch {
  inputs 4
  which {{ControlGizmo.output i}}
  name SwitchGrainAlpha
  xpos -147
  ypos 1537
 }
 Output {
  name Output1
  xpos -147
  ypos 1829
 }
 NoOp {
  inputs 0
  name ControlGizmo
  xpos -450
  ypos 1641
  addUserKnob {20 User}
  addUserKnob {6 invertMask l "invert mask" +STARTLINE}
  addUserKnob {26 version l v2.1}
  addUserKnob {4 output M {"final result" "red matte" "green matte" "blue matte"}}
 }
push $N945dbe0
 Viewer {
  gain 0.8
  input_process false
  name Viewer1
  xpos 115
  ypos 836
 }
end_group
