This is a read-only mirror of pymolwiki.org

Difference between revisions of "Png"

From PyMOL Wiki
Jump to navigation Jump to search
(New comment about transparent png's)
 
m
(7 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
===USAGE===
 
===USAGE===
  png filename
+
  png filename, dpi, ray
 +
 
 +
* '''dpi''', sets the dots per inch (dpi) of the final image
 +
* '''ray''', whether or not PyMOL ray traces the image before saving
  
 
===PYMOL API===
 
===PYMOL API===
 
<source lang="python">
 
<source lang="python">
cmd.png( string file )
+
cmd.png( string file, dpi, ray )
 
</source>
 
</source>
  
 
===COMMENTS===
 
===COMMENTS===
To obtain transparent png images, use the following command before ray-tracing and exporting your scene:
 
set ray_opaque_background, 0
 
  
[[Category:Commands|png]]
+
====Blank Screen Shots====
 +
If, when you execute the [[Png]] command, you get blank images, you may have to [[Ray]] trace your image first, before running the [[Png]] command.  This occurs when there is no device context for the image, such as when running PyMOL in quiet gui-less mode.  If the ray tracing is taking too long due to scene complexity or size, then please see the [[Ray]] page or search the wiki for information about making movies with PyMOL (there are many ways to [[:Category:Performance|speed]] up rendering).
 +
 
 +
====Transparent Backgrounds====
 +
See [[Ray_opaque_background]].  This is very useful for presentations, or images that are placed on top of a background of nonuniform color, or if you simply want a transparent background for your images.
 +
 
 +
====DPI Setting====
 +
Use the DPI option to have PyMol set the DPI of your image.  If I execute
 +
<source lang="python">ray 1200,1200</source>
 +
then execute
 +
<source lang="python">png /tmp/ex.png, dpi=300</source>
 +
I will get a four-inch square image at 300dpi.  Leaving off the '''dpi''' flag would net me a 1200x1200 image at 72dpi.  This saves the intermediate step of having to use GIMP/PhotoShop/etc to rescale your photos for publication.
 +
 
 +
[[Category:Commands|Png]]
 +
[[Category:Publication_Quality|Png]]
 +
[[Category:Performance|Png]]

Revision as of 14:18, 20 June 2009

DESCRIPTION

png writes a png format image file of the current image to disk.

USAGE

png filename, dpi, ray
  • dpi, sets the dots per inch (dpi) of the final image
  • ray, whether or not PyMOL ray traces the image before saving

PYMOL API

cmd.png( string file, dpi, ray )

COMMENTS

Blank Screen Shots

If, when you execute the Png command, you get blank images, you may have to Ray trace your image first, before running the Png command. This occurs when there is no device context for the image, such as when running PyMOL in quiet gui-less mode. If the ray tracing is taking too long due to scene complexity or size, then please see the Ray page or search the wiki for information about making movies with PyMOL (there are many ways to speed up rendering).

Transparent Backgrounds

See Ray_opaque_background. This is very useful for presentations, or images that are placed on top of a background of nonuniform color, or if you simply want a transparent background for your images.

DPI Setting

Use the DPI option to have PyMol set the DPI of your image. If I execute

ray 1200,1200

then execute

png /tmp/ex.png, dpi=300

I will get a four-inch square image at 300dpi. Leaving off the dpi flag would net me a 1200x1200 image at 72dpi. This saves the intermediate step of having to use GIMP/PhotoShop/etc to rescale your photos for publication.