Skip to content

Instantly share code, notes, and snippets.

@mutterer
Last active July 18, 2021 22:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mutterer/883b32fb4dd7d9bcbd9a1ee32f1a2fd9 to your computer and use it in GitHub Desktop.
Save mutterer/883b32fb4dd7d9bcbd9a1ee32f1a2fd9 to your computer and use it in GitHub Desktop.
ImageJ macro that creates a montage with hue shifted image copies.
// emoji from https://emojipedia.org/
url="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/whatsapp/273/face-with-medical-mask_1f637.png";
hues=8;
open(url);
setBatchMode(1);
run("Duplicate...","title=temp");
Color.setForeground("blue");floodFill(0, 0);
run("Size...", "width="+Image.width+" height="+Image.height+" depth="+hues+" constrain average interpolation=Bilinear");
run("HSB Stack");
Stack.getDimensions(width, height, channels, slices, frames);
Stack.setChannel(1);
for(i=1; i<=slices; i++) {
Stack.setSlice(i);
run("Macro...", "code=v=(v+"+i*256/hues+")%256 slice");
}
run("RGB Color", "slices keep");
run("Make Montage...", "scale=1");
setBatchMode(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment