Following the German motto “Ordnung ist das halbe Leben!”
Have you ever been frustrated by having to differentiate between dozens of similar graphs or figures, and the only memorable difference between them were their unique file names?
In a recent simulation study, I had exactly that feeling, so I came up with some code to automatically label figures with their file names. Here is how it works:
For example, please assume three similar graphs with the file names testResults_A.png, testResults_B.png, and testResults_C.png, respectively.
Let us annotate each figure automatically with its file name (but excluding the file type ending) using ImageMagick.
for i in $(ls *.png); do convert $i -background Orange label:${i%.png*} +swap -gravity Center -append ${i%.png*}.withAnno.png; done
On the top of each figure, an orange bar with the respective file name has now been added.
UPDATE: I found it necessary to manually set the font size in several cases. It is hereby important to set option pointsize as the first option in the list.
for i in $(ls *.png); do convert $i -pointsize 60 -background Orange label:${i%.png*} +swap -gravity Center -append ${i%.png*}.withAnno.png; done