// Copyright 2007 Matt Sandstršm/Too Much Too Soon // This script is freeware, meaning you may copy and // distribute it free of charge, as long as it's kept intact, // including this message. Feel free to use the code as // inspiration for your own scripts, but don't steal. // Email me at mattias@beauty.se if you have any questions. // Thank you. Have fun. filter "Smooth & Sharp"; group "TMTS Stylize"; input st, "Threshold", slider, 3, 0, 10 detent 0; input sm, "Smooth Amount", slider, 3, 0, 10 detent 0; input sh, "Sharp Amount", slider, 1, 0, 10 detent 0; input sz, "Filter Radius", slider, 3, 0, 10; code float i,w,h,clut[256]; dimensionsof(dest,w,h); image blurbuf[w][h],posbuf[w][h],negbuf[w][h]; blur(src1,blurbuf,sz,aspectof(dest)) subtract(blurbuf,src1,negbuf,1,knone) subtract(src1, blurbuf, posbuf,1,knone) for i = 0 to st clut[i] = i/255 * (sqrt(sm+1)) - st/255*(sqrt(sm+1)-1); if clut[i] < 0 then clut[i] = 0; end if; next; for i = st + 1 to 255 clut[i] = i/255 * (sqrt(3*sh+1)) - (st+1)/255*(sqrt(3*sh+1)-1); if clut[i] > 1 then clut[i] = 1; end if; next; levelmap(negbuf, negbuf, clut, clut, clut, clut); levelmap(posbuf, posbuf, clut, clut, clut, clut); add(posbuf,blurbuf,blurbuf,1,knone); subtract(blurbuf,negbuf,dest,1,knone);