OERenderMolecule
Link |
Description |
|---|---|
renders a molecule display into an image |
|
renders molecule into an image using the default depiction style |
|
writes a molecule display into a file |
|
writes a molecule into a file using the default depiction style |
|
writes a molecule display into an output stream |
|
writes a molecule into an output stream using the default depiction style |
Hint
Setting the clearbackground option to false, allows the generation of images with transparent background.
clearbackground [1] |
effect |
|---|---|
true (default) |
clears the image by drawing a rectangle underneath the molecule with the background color [2] before molecule rendering |
false |
does not clear the image, enabling the generation of transparent images (for example PNG, SVG) |
See the Generating Transparent PNG Python cookbook example.
OERenderMolecule(image: OEImageBase, disp: OE2DMolDisplay,
clearbackground: bool = True) -> bool
Renders the molecule display into an image.
- image
The image in which the molecule is drawn.
- disp
The OE2DMolDisplay object that holds the data necessary to depict the molecule with which it is initialized.
- clearbackground
Determines whether or not the image is cleared (by calling
OEImageBase.Clearmethod) prior to rendering the molecule; as a result, by default a white rectangle will be drawn underneath the molecule.
Example:
oedepict.OEPrepareDepiction(mol)
image = oedepict.OEImage(200.0, 200.0)
opts = oedepict.OE2DMolDisplayOptions(image.GetWidth(), image.GetHeight(),
oedepict.OEScale_AutoScale)
disp = oedepict.OE2DMolDisplay(mol, opts)
oedepict.OERenderMolecule(image, disp)
See also
OEImageBase class
OE2DMolDisplay class
OERenderMolecule(image: OEImageBase,
mol: Union[OEGraphMol,OEMol,OEQMol],
clearbackground: bool = True) -> bool
Renders a molecule into an image using the default depiction style.
- image
The image in which the molecule is drawn.
- mol
The molecule being rendered has to have valid 2D coordinates before calling the
OERenderMoleculefunction.- clearbackground
Determines whether or not the image is cleared (by calling
OEImageBase.Clearmethod) prior to rendering the molecule; as a result, by default a white rectangle will be drawn underneath the molecule.
Example:
oedepict.OEPrepareDepiction(mol)
image = oedepict.OEImage(200.0, 200.0)
oedepict.OERenderMolecule(image, mol)
See also
OEImageBase class
OERenderMolecule(filename: str, disp: OE2DMolDisplay,
clearbackground: bool = True) -> bool
Writes the molecule display into a file.
- filename
The name of the file into which the molecule display is being written. The extension of the filename determine the type of the image.
- disp
The OE2DMolDisplay object that holds the data necessary to depict the molecule with which it is initialized.
- clearbackground
Determines whether or not the image is cleared (by calling
OEImageBase.Clearmethod) prior to rendering the molecule; as a result, by default a white rectangle will be drawn underneath the molecule.
Example:
oedepict.OEPrepareDepiction(mol)
opts = oedepict.OE2DMolDisplayOptions(200.0, 200.0, oedepict.OEScale_AutoScale)
disp = oedepict.OE2DMolDisplay(mol, opts)
oedepict.OERenderMolecule("OERenderMolecule-fname-disp.png", disp)
See also
OE2DMolDisplay class
OERenderMolecule(filename: str, mol: Union[OEGraphMol,OEMol,OEQMol],
clearbackground: bool = True) -> bool
Writes a molecule into a file using the default depiction style.
- filename
The name of the file into which the molecule is written. The extension of the filename determine the type of the image.
- mol
The molecule being rendered has to have valid 2D coordinates before calling the
OERenderMoleculefunction.- clearbackground
Determines whether or not the image is cleared (by calling
OEImageBase.Clearmethod) prior to rendering the molecule; as a result, by default a white rectangle will be drawn underneath the molecule.
Example:
oedepict.OEPrepareDepiction(mol)
oedepict.OERenderMolecule("OERenderMolecule-fname-mol.png", mol)
OERenderMolecule(os: oeostream, extension: str, disp: OE2DMolDisplay,
clearbackground: bool = True) -> bool
Writes the molecule display into a stream.
- os
The stream into which the molecule display is being written.
- ext
The extension which determine the type of the image.
- disp
The OE2DMolDisplay object that holds the data necessary to depict the molecule with which it is initialized.
- clearbackground
Determines whether or not the image is cleared (by calling
OEImageBase.Clearmethod) prior to rendering the molecule; as a result, by default a white rectangle will be drawn underneath the molecule.
Example:
oedepict.OEPrepareDepiction(mol)
opts = oedepict.OE2DMolDisplayOptions(200.0, 200.0, oedepict.OEScale_AutoScale)
disp = oedepict.OE2DMolDisplay(mol, opts)
ofs = oechem.oeofstream("OERenderMolecule-stream-disp.png")
oedepict.OERenderMolecule(ofs, "png", disp)
See also
oeostream class in the OEChem TK manual
OE2DMolDisplay class
OERenderMolecule(os: oeostream, extension: str,
mol: Union[OEGraphMol,OEMol,OEQMol],
clearbackground: bool = True) -> bool
Writes a molecule into a stream using the default depiction style.
- os
The stream into which the molecule is being written.
- ext
The extension which determine the type of the image.
- mol
The molecule being rendered has to have valid 2D coordinates before calling the
OERenderMoleculefunction.- clearbackground
Determines whether or not the image is cleared (by calling
OEImageBase.Clearmethod) prior to rendering the molecule; as a result, by default a white rectangle will be drawn underneath the molecule.
Example:
oedepict.OEPrepareDepiction(mol)
ofs = oechem.oeofstream("OERenderMolecule-stream-mol.png")
oedepict.OERenderMolecule(ofs, "png", mol)
See also
oeostream class in the OEChem TK manual