Skip to content

Instantly share code, notes, and snippets.

@mutterer
Last active June 21, 2020 20:33
Show Gist options
  • Save mutterer/abf134dd593a751a9e1878eedfda1ccf to your computer and use it in GitHub Desktop.
Save mutterer/abf134dd593a751a9e1878eedfda1ccf to your computer and use it in GitHub Desktop.
tape text effect macro
// reproduce tape text effect seen here: https://twitter.com/Ulrike_Boehm/status/1274720476548476929
lines = newArray("@ahklemm rocks","and yes, ImageJ macros are", "so satisfying");
tape = newArray("#ffdd5d","8ba4ff","#ffb9d1");
letters = "#ffffff";
shadow = "#444444";
run("Blobs");
run("Remove Overlay");
setFont("American Typewriter", 12, " antialiased");
setJustification("center")
angle=10;
w = getWidth;
h = getHeight;
vSpace = getValue('font.height')*1.5;
for (i=0;i<lines.length;i++) {
s=" "+lines[i]+" ";
a = angle+random()*6;
tilt = getStringWidth(s)*sin(2*PI*a/360)/2;
Overlay.drawString(s, w/2, h/2+i*vSpace+tilt, a);
Overlay.drawString(s, w/2-1, h/2+i*vSpace+tilt-1, a);
Overlay.show();
Overlay.activateSelectionAndWait(Overlay.size-2);
Roi.setFillColor(tape[i%tape.length]);
Roi.setStrokeColor(shadow);
Overlay.activateSelection(Overlay.size-1);
Roi.setStrokeColor(letters);
run("Select None");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment