From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Aug 08 2012 - 16:57:18 CDT

Hi,
  Since people don't appear to realize that the "text" graphics/draw
commands are more powerful than they used to be, I thought I'd reply to
this and give an example of how you can scale the text size and thickness
to make it stand out much better for movie making. In the example script
below, you can do something like this:
  draw text {70 40 80 } "$time" size 4 thickness 10

Cheers,
  John

On Wed, Aug 08, 2012 at 04:49:54PM -0500, Peter C. Lai wrote:
> Woops last message got cut off.
>
> You can use a combination of trace and "draw text" commands in VMD to have it
> draw text on each frame. The following code updates the timeindex in ps on
> each frame (where the trajectory is 4 ps per frame), starting from 0 ps.
>
> proc enabletrace {} {
> global vmd_frame;
> trace variable vmd_frame([molinfo top]) w drawcounter
> }
>
> proc disabletrace {} {
> global vmd_frame;
> trace vdelete vmd_frame([molinfo top]) w drawcounter
> }
>
> proc drawcounter { name element op } {
> global vmd_frame;
>
> draw delete all
> # puts "callback!"
> draw color white
> set psperframe 4
> set psoffset 0
> set time [format "%d ps" [expr ($vmd_frame([molinfo top]) * $psperframe) + $psoffset]]
> draw text {70 40 80 } "$time"
> }
>
> However draw text only draws basically rudimentary OpenGL line objects so the
> labels get clobbered if the scene is really busy.
>
> Most of the time, I actually use ImageMagick to tag the time index on each
> frame before using FFMpeg to make the movie (although mencoder works too!)
> http://www.imagemagick.org/script/index.php
>
> The following Bash script works on Linux or Mac on the ppm output from VMD's
> moviemaker extension (I don't have it encode, only dump the frames).
>
> The basic ImageMagick command to do this is:
> convert -font font -fill white -pointsize 36 -draw 'text 700,950 "0 ps"' file.in file.out
>
> Example In bash:
>
> find . -name "*.ppm" | while read line
> do ts=$(echo $line | awk -F . '{print $3}')
> rt=$(expr $ts \* 4)
> rt="${rt} ps"
> echo $rt
> convert -font helvetica -fill white -pointsize 36 -draw "text 725,950 '$rt'" $line foo.$ts.jpg
> done
>
> If you are manually dumping frames in a VMD script with render instead of the
> using the moviemaker plugin then you can have ImageMagick work on the
> imageformat you dumped to (TGA, BMP, etc.). This saves time because compared
> to using the moviemaker plugin since you don't have to wait for vmd to run
> pnmtools on each frame before going to postprocess.
>
> On 2012-08-08 12:04:58PM -0500, Bryan Roessler wrote:
> > Hello,
> >
> > I was wondering if it would be possible to have the option to superimpose
> > the current frame number on the display? This would be really helpful for
> > making movies that loop so the audience could follow the movement. Also, if
> > you are still looking for a free BMP movie encoder, mencoder works great.
> >
> > For example: "C:\Program Files (x86)\Mencoder\mencoder.exe"
> > mf://yourname*.bmp -mf fps=15:type=bmp -ovc lavc -lavcopts
> > vcodec=wmv2:vbitrate=10000 -o yourname.wmv
> >
> > Thanks,
> >
> > Bryan
>
> --
> ==================================================================
> Peter C. Lai | University of Alabama-Birmingham
> Programmer/Analyst | KAUL 752A
> Genetics, Div. of Research | 705 South 20th Street
> pcl_at_uab.edu | Birmingham AL 35294-4461
> (205) 690-0808 |
> ==================================================================

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/       Fax: 217-244-6078