Using ImageMagick's command line tools

In writing data analysis reports, it is often useful to add place arbitrary captions onto the bottom of images and combine then onto one page. This can be done on Linux with the ImageMagick command-line tools. You first call "convert" on the individual files, then "montage" them all together.
unix% convert tsys.spw0.t1.png -pointsize 48 label:'Here is a Tsys plot' -gravity Center -append tsys.spw0.t1.labeled.png
unix% convert tsys.spw0.t7.png -pointsize 48 label:'Here is another Tsys plot' -gravity Center -append tsys.spw0.t7.labeled.png
unix% montage -geometry 1024x768 tsys.spw0.t1.labeled.png tsys.spw0.t7.labeled.png summary.png

To run this from inside casa or python, you can make system calls:
>> os.system("convert obs_display.png -pointsize 48 label:'Observing Schedule' -gravity Center -append obs_display_labeled.png")
>> os.system("antenna_config.png -pointsize 48 label:'Antenna configuration' -gravity Center -append antenna_config_labeled.png")
>> os.system("wvr_plot.png -pointsize 48 label:'Before and after wvr correction' -gravity Center -append wvr_plot_labeled.png")
>> os.system('montage -tile 2X3 -geometry 300x200+0+0   obs_display_labeled.png   antenna_config_labeled.png   wvr_plot_labeled.png ant_amp_temporal.png  ant_phase_temporal.png   qa2_part1.png')

-- ToddHunter - 2012-04-06

This topic: Main > TWikiUsers > ToddHunter > CasaExtensions > ImageMagickMontage
Topic revision: 2012-04-06, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback