Welcome everybody to the PyMOL mailing list. There are over 30 subscribers. I am very pleased that so many people want to use (and thereby improve) the package.
> From: Ben Cornett > Does anyone know how to get the size (pixels) of the viewer? I'd like > to be able to write a python script that orients and colors a molecule > and then renders it at whatever dpi I provide as a command-line > argument. Ben, Hmm, not all of those features may exist yet, but the following will help. The "viewport" command can be used to change the window size. Alternatively, the "ray" command can take width and height arguments. Remember that two options exist for scripting: PyMOL commands and Python. The former is easier for quick-and-dirty tasks. # SCRIPT fig1.pml (PyMOL command language) # RUN AS "pymol -c fig1.pml" viewport 1024,768 load example.pdb color marine orient ray png fig1.png # END versus # SCRIPT fig2.py (Python) # RUN AS "pymol -c fig2.py" from pymol import cmd cmd.viewport(1024,768) cmd.load("example.pdb") cmd.color("marine") cmd.orient() cmd.ray() cmd.png("fig2.png") # END also equivalent to # SCRIPT fig3.pml (PyMOL) # RUN AS "pymol -c fig3.pml" load example.pdb color marine orient ray 1024,768 png fig3.png # END Passing additional command arguments can't yet be done reliably, but you might try playing around with -d (at least on unix). Note single quotes and no spaces within the quote. pymol -d 'w=1024;h=768' should define "w" and "h" in the interpreter namespace. Thus, the following works... # SCRIPT fig3.py (Python) # RUN AS "pymol -c -d 'w=1024;h=768' fig3.py " from pymol import cmd cmd.load("example.pdb") cmd.color("marine") cmd.orient() cmd.ray(w,h) cmd.png("fig3.png") # END You might even be able to pass in the input and output filenames: pymol -c -d 'w=1024;h=768;i=example.pdb;o=fig4.png' fig4.py # SCRIPT fig4.py (Python) from pymol import cmd cmd.load(i) cmd.color("marine") cmd.orient() cmd.ray(w,h) cmd.png(o) # END - Warren