Overlay image title onto image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Overlay image title onto image

knels
Hello,


I am wondering if anyone knows of any macros which can automatically label an image with its title in the top left. I'm not too savvy with imagej macros. But I was thinking if it were possible to use a function that specifies the name by getTitle; and then inserts a box with the title as the text.


I manually inserted this image's title. So if there were an automatic way to do this it would be wonderful. Thanks so much!

Reply | Threaded
Open this post in threaded view
|

Re: Overlay image title onto image

knels
Actually I figured something out. I also added a black bar at the top to place the title name so the title does not need to obstruct view of any part of the image (picture of how it looks below). I think if anyone needs something like this in the future this is what I used:


//////////////////////

name=getTitle;


setBackgroundColor(0, 0, 0);
w=getWidth();
h=getHeight()+35;
run("Canvas Size...", "width=w height=h position=Bottom-Center");
setFont("Sanserif", 24);
  makeText(name, 2, 2);
setForegroundColor(255, 255, 255);
run("Draw", "slice");