Generate macro tool icon from text

Hi everyone,
I’m looking for a simple way to generate custom macro tool icon, ie to get the hexadecimal code as shown in the ImageJ doc.

Especially to generate icons with text only.
I found @jerome.mutterer Image to Tool macro but I could not generate satisfying image quality.

“Update default ROI” looks like
image

Maybe I should cut down the icon label too but some icon generator would help.

Hi Laurent.
You’re right, the image to tool icon is only good for images.
You can try the following macro.
Text size here is 04, which is the smallest readable font in my opinion

macro "Test Action Tool - C000 T0404TT3404oT6404oT9404lT0804IT3804cT6804oT9804nT0c04MT3c04aT6c04cT9c04rTcc04o" {
  s = ""; 
  t = newArray( "Tool", "Icon", "Macro" ); 
  for( l = 0; l < t.length; l ++ ) { 
    for( i = 0; i < lengthOf( t [ l ] ); i ++ ) { 
      s = s + "T" + toHex( 3 * i )+ "" + toHex( 4 + 4 * l )+ "04" + substring( t [ l ], i, i + 1 ); 
    } 
  } 
  print( s ); 
}
2 Likes

Thanks @jerome, I actually gave up with the too long text and find an representative icon on


which offers the option to download as 16x16 pixel image, which I could use with the original macro.

The icon will be soon visible in the Roi 1-click tool macro toolset :wink:

1 Like

For the record, this is what you’ll get using a 26x26 png icon located in macros/toolsets/icons/ using the new syntax allowed in IJ > 1.53b26.

macro “Test Action Tool - icon:text833.png” { … }

image

1 Like