Skip to content

Instantly share code, notes, and snippets.

@mutterer
Created December 21, 2020 21:39
Show Gist options
  • Save mutterer/f1975dc584363ee3ec914ffc7fbbd620 to your computer and use it in GitHub Desktop.
Save mutterer/f1975dc584363ee3ec914ffc7fbbd620 to your computer and use it in GitHub Desktop.
A 2021 colourful script
// colours of 2021
call("ij.gui.ImageWindow.centerNextImage");
newImage("2020 LUTs demo", "8-bit black", 512, 256, 1);
r=10;
setForegroundColor(255,255,255);
luts = getList("LUTs");
lut=0;
makeLine(78,90,97,61,134,63,149,91,76,174,66,157,139,180,170,160);
run("Fit Spline");
run("Interpolate", "interval=1 smooth");
Roi.getCoordinates(x2,y2);
l = x2.length;
makeLine(238,53,201,71,192,138,221,182,257,136,254,72,212,52);
run("Fit Spline");
run("Interpolate", "interval=1 smooth");
Roi.getCoordinates(x0,y0);
makeLine(396,129,442,56,432,57,433,181,427,190,391,190,471,190);
run("Fit Spline");
run("Interpolate", "interval=1 smooth");
Roi.getCoordinates(x1,y1);
x0=Array.resample(x0,l);
y0=Array.resample(y0,l);
x1=Array.resample(x1,l);
y1=Array.resample(y1,l);
while(lut<luts.length-1) {
rename("Happy "+luts[lut]);
run(luts[(lut++)%luts.length]);
for(i=0;i<x2.length;i++) {
makeOval(x2[i],y2[i],r,r);
fill();
makeOval(x2[l-i-1]+210,y2[l-i-1],r,r);
fill();
makeOval(x0[i],y0[i],r,r);
fill();
makeOval(x1[i],y1[i]-10,r,r);
fill();
run("Select None");
if(i%6==0) run("Subtract...", "value=2");
if(i%10==0) {
d=3+3*random();
makeOval(getWidth*random(),getHeight*random(),d,d);
fill();
}
if(i%2==0) run("Gaussian Blur...", "sigma=0.4");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment