Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #@gui Cascading self glitching: fx_self_glitching_cascade, fx_self_glitching_cascade_preview(1)
- #@gui : note = note("Shifts images in a cascading fashion but computes values based on shifted and original images.")
- #@gui : note = note("<small>This filter has many channel options and many operation options allowing for extremely-distorted images. Don't always trust the preview!</small>"), sep = separator()
- #@gui : 1. Shift channels = choice("RGB/sRGB","CMYK/CMY","HSV/HSV8","HSL/HSL8","HSI/HSI8","LCH/LCH8","Lab/Lab8","YCbCr/YCbCr_2","YIQ/YIQ8","YUV/YUV8","Bayer/HCY","XYZ/XYZ8")
- #@gui : 2. Alt choice = bool(0)
- #@gui : 3. Process Alpha = bool(0)
- #@gui : 4,5. Zeroth shift = point(50,50,0,1,255,255,255,175)
- #@gui : 6. Boundary = choice(3,"Zero","Nearest","Periodic","Mirror")
- #@gui : sep = separator()
- #@gui : 7. Iterations = int(3,1,64)
- #@gui : 8. Repeat post-shift operations = bool(1)
- #@gui : sep = separator()
- #@gui : 9,10. Shift target = point(55,55,0,1,255,0,0,175)
- #@gui : 11. Target for final (rather than first) shift = bool(0)
- #@gui : 12,13. Cascade centre point = point(45,45,0,1,0,255,0,175)
- #@gui : 14. Shift randomness = float(0.75,0,4)
- #@gui : 15. Boundary = choice(3,"Zero","Nearest","Periodic","Mirror")
- #@gui : 16. Power = float(0,-5,5)
- #@gui : 17. Bias = float(0,-256,256)
- #@gui : 18. Negation = bool(0)
- #@gui : 19. Shift Operator = choice("Add","Multiply","Bitwise And","Bitwise Or","Bitwise Xor","Power","Reverse Power",
- #@gui : "Modulo","Reverse Modulo","Divide","Reverse Divide","Subtract","Reverse Subtract",
- #@gui : "Left Bitwise Shift","Reverse LBS","Right Bitwise Shift","Reverse RBS","Left Bitwise Rotation","Reverse LBR","Right Bitwise Rotation","Reverse RBR",
- #@gui : "Average","Round","Reverse Round","Sine","Reverse Sine","Cosine","Reverse Cosine","Tangent","Reverse Tangent (CPU-intensive)",
- #@gui : "Cosecant","Reverse Cosecant","Secant","Reverse Secant","Cotangent","Reverse Cotangent","Variance","Difference","Minimum","Maximum",
- #@gui : "Interference (Add)","Reverse Interference (Add)","Interference (Multiply)",
- #@gui : "Interference (Divide)","Reverse Interference (Div)",
- #@gui : "Interference (Subtract)","Reverse Interference (Subt)","Interference (Rev Subt)","Reverse Interference (Rev Subt)",
- #@gui : "Interference (Difference)","Reverse Interference (Diff)","Interference (Variance)",
- #@gui : "Screen","Colour Dodge","Reverse Colour Dodge","Colour Burn","Reverse Colour Burn","Soft Light (illusions.hu)","Reverse Soft Light (illusions.hu)",
- #@gui : "Geometric Mean","Bright Hard Mix","Dark Hard Mix")
- #@gui : 20. Multiplier 1 = float(1,-10,10)
- #@gui : 21. Addition 1 = int(0,-1024,1024)
- #@gui : 22. Post-Shift Modulo = int(256,1,1024)
- #@gui : 23. Multiplier 2 = float(1,-10,10)
- #@gui : 24. Addition 2 = int(0,-1024,1024)
- #@gui : 25. Custom command before shift = text(1,)
- #@gui : 26. Custom command after shift = text(1,)
- #@gui : sep = separator(), 27. Run on channel(s) = choice("All","RGBA [all]","RGB [all]","RGB [red]","RGB [green]","RGB [blue]","RGBA [alpha]","Linear RGB [all]","Linear RGB [red]","Linear RGB [green]","Linear RGB [blue]","YCbCr [luminance]","YCbCr [blue-red chrominances]","YCbCr [blue chrominance]","YCbCr [red chrominance]","YCbCr [green chrominance]","Lab [lightness]","Lab [ab-chrominances]","Lab [a-chrominance]","Lab [b-chrominance]","Lch [ch-chrominances]","Lch [c-chrominance]","Lch [h-chrominance]","HSV [hue]","HSV [saturation]","HSV [value]","HSI [intensity]","HSL [lightness]","CMYK [cyan]","CMYK [magenta]","CMYK [yellow]","CMYK [key]","YIQ [luma]","YIQ [chromas]")
- # #@gui : sep = separator(), 28. Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right","Duplicate horizontal","Duplicate vertical","Checkered","Checkered inverse"), Preview split = point(50,50,0,0,200,200,200,0,10,0)
- #@gui : sep = separator(), note = note("<small>Original author: <i><a href="https://goo.gl/Ryf7Cv">David Tschumperlé</a></i>; extended by some nobody who calls themselves 'Joan Rake' or something.<p>Latest update: <i>2018/08/24</i>.</small>")
- fx_self_glitching_cascade :
- skip "${25=-skip ,}","${26=-skip ,}"
- shift {$4-50}%,{$5-50}%,0,0,$6,0
- repeat $! l[$>] if {!$3} split_opacity fi l[0] to_rgb
- if {$2}
- if {$1==0} rgb2srgb
- elif {$1==1} rgb2cmy
- elif {$1==2} rgb2hsv8
- elif {$1==3} rgb2hsl8
- elif {$1==4} rgb2hsi8
- elif {$1==5} rgb2lch8
- elif {$1==6} rgb2lab8
- elif {$1==7} rgb2ycbcrglic2
- elif {$1==8} rgb2yiq8
- elif {$1==9} rgb2yuv8
- elif {$1==10} rgb2hcy
- elif {$1==11} rgb2xyz8
- fi else
- if {$1==1} rgb2cmyk
- elif {$1==2} rgb2hsv
- elif {$1==3} rgb2hsl
- elif {$1==4} rgb2hsi
- elif {$1==5} rgb2lch
- elif {$1==6} rgb2lab
- elif {$1==7} rgb2ycbcr
- elif {$1==8} rgb2yiq
- elif {$1==9} rgb2yuv
- elif {$1==10} rgb2bayer 0
- elif {$1==11} rgb2xyz
- fi fi
- if $11 stype=$7 else stype=1 fi
- repeat $7
- +shift[0] {((([w,h]-1)*([$12,$13]-[$9,$10]+[u(-1,1),u(-1,1)]*sqrt((($12-$9)^2)+(($13-$10)^2))*($14^3)))/$stype)/100},0,0,$15
- m "_fx_custom_code_csg1_start : "$25"
- l[0] _fx_custom_code_csg1_start endl
- uncommand _fx_custom_code_csg1_start
- f.. "begin(
- const sign = $18?-1:1;
- );
- operate(mode,s1,s2,mult,power) =
- (mode==0?(s1 + s2):
- mode==1?(s1 * s2):
- mode==2?(s1 & s2):
- mode==3?(s1 | s2):
- mode==4?xor(s1,s2):
- mode==5?(s1^(s2*0.01)):
- mode==6?(s2^(s1*0.01)):
- mode==7?(s1%s2):
- mode==8?(s2%s1):
- mode==9?(s1 / s2):
- mode==10?(s2 / s1):
- mode==11?(s2 - s1):
- mode==12?(s1 - s2):
- mode==13?(s1 << s2):
- mode==14?(s2 << s1):
- mode==15?(s1 >> s2):
- mode==16?(s2 >> s1):
- mode==17?for(n=0,n<(s2%32),n++,rol(s1)):
- mode==18?for(n=0,n<(s1%32),n++,rol(s2)):
- mode==19?for(n=0,n<(s2%32),n++,ror(s1)):
- mode==20?for(n=0,n<(s1%32),n++,ror(s2)):
- mode==21?avg(s2,s1):
- mode==22?round(s1,s2,0):
- mode==23?round(s2,s1,0):
- mode==24?s2*sin(s1*2*pi/mult):
- mode==25?s1*sin(s2*2*pi/mult):
- mode==26?sign*s2*cos(s1*2*pi/mult):
- mode==27?sign*s1*cos(s2*2*pi/mult):
- mode==28?s2*tan(s1*pi/mult):
- mode==29?s1*tan(s2*pi/mult):
- mode==30?s2*sin(mult/(s1*2*pi)):
- mode==31?s1*sin(mult/(s2*2*pi)):
- mode==32?sign*s2*cos(mult/(s1*2*pi)):
- mode==33?sign*s1*cos(mult/(s2*2*pi)):
- mode==34?s2*tan(mult/(s1*pi)):
- mode==35?s1*tan(mult/(s2*pi)):
- mode==36?mult*var(s1,s2):
- mode==37?abs(s2 - s1):
- mode==38?min(s2,s1):
- mode==39?max(s2,s1):
- mode==40?0.005*s2*(((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power))+s1):
- mode==41?0.005*s1*((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)+s2):
- mode==42?0.1*s2*(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)*s1:
- mode==43?0.1*s2*(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)/s1:
- mode==44?0.1*s1*(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)/s2:
- mode==45?0.001*s2*((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)-s1):
- mode==46?0.001*s1*((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)-s2):
- mode==47?0.001*s2*(s1-(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)):
- mode==48?0.001*s1*(s2-(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)):
- mode==49?0.001*s2*abs((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)-s1):
- mode==50?0.001*s1*abs((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)-s2):
- mode==51?0.00001*mult*var(s1,s2,(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)):
- mode==52?(255-((255-s1)*(255-s2))):
- mode==53?(s1/(255-s2)):
- mode==54?(s2/(255-s1)):
- mode==55?((255-s2)/s1*255):
- mode==56?((255-s1)/s2*255):
- mode==57?((((s1)/255)^2)^(2*(0.5-(s2/255))))*255:
- mode==58?((((s2)/255)^2)^(2*(0.5-(s1/255))))*255:
- mode==59?sqrt(abs(s1*s2)):
- mode==60?(if((s1+s2)>=255,255,0)):
- (if((s1+s2)<=255,0,255)));
- val = sign*((2^$16)*j(#-1) + $17);operate($19,val,i,$20,$16);
- " rm.
- if {$8}
- f "((((i*$20)+$21)%$22)*$23)+$24;"
- fi
- done
- if {!$8}
- f "((((i*$20)+$21)%$22)*$23)+$24;"
- fi
- if {$2}
- if {$1==0} srgb2rgb
- elif {$1==1} cmy2rgb
- elif {$1==2} hsv82rgb
- elif {$1==3} hsl82rgb
- elif {$1==4} hsi82rgb
- elif {$1==5} lch82rgb
- elif {$1==6} lab82rgb
- elif {$1==7} ycbcrglic2rgb
- elif {$1==8} yiq82rgb
- elif {$1==9} yuv82rgb
- elif {$1==10} hcy2rgb
- elif {$1==11} xyz82rgb
- fi else
- if {$1==1} cmyk2rgb
- elif {$1==2} hsv2rgb
- elif {$1==3} hsl2rgb
- elif {$1==4} hsi2rgb
- elif {$1==5} lch2rgb
- elif {$1==6} lab2rgb
- elif {$1==7} ycbcr2rgb
- elif {$1==8} yiq2rgb
- elif {$1==9} yuv2rgb
- elif {$1==10} bayer2rgb 0,0,0
- elif {$1==11} xyz2rgb
- fi fi
- endl a c endl done
- fx_self_glitching_cascade_preview :
- fx_self_glitching_cascade $*
- #repeat {max(0,l)}
- #ac[$>] "-fx_self_glitching_cascade $*",$27
- #done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement