Home   |   Products   |   Consulting Services   |   Contact us    



  Chemical Registration
  Reaction-based Libraries
  NMRPredict Version 2 - NEW!
  NMRBenefit - NEW!
  Chemical Supplier Catalogue
  Database Integration
  Structure Drawing Control
  Imaging Suite
  Barcode Solutions





dmol2image - create molecular images of database molecules


dmol2image is like mol2image, but it retrieves molecules from a relational database (MOL records as CLOBs) and generates images. Images can be GIF, JPG or PNG files.

The database query is fully configurable -- tables and columns can be specified with the --table, -idcolumn and --molcolumn options, and login information is usually supplied via environment variables (see Environment, below).

dmol2image operates either in command-line mode or as high-performance FastCGI web image servers. For more information about FastCGI, see http://www.fastcgi.com/ .

If the record retrieved from the database is an SD file and contains more than one molecule, only the first molecule is used.

Command-line mode

If database keys are supplied on the command line, dmol2image goes into command-line mode, and one or more image files are created.

By default, the image is written to standard output. If more than one key is given, the --basename option must be used to generate a name for each file.

With no --basename option, a single key can follow the options on the command line, and the image is written to standard output, for example:

    dmol2image 1234 >file.png

If --basename is specified, dmol2image creates a series of files by concatenating basename and key. Example:

    dmol2image -b /tmp/my_ 1001 1002 1003

would create three files in /tmp, called my_1001.png, my_1002.png and my_1003.png. A basename of '-' means a blank basename, that is, create files, but use the unaltered key as the filename. Note that certain characters in the key such as '/' will be replaced with '_'.

Command-line keys can also be specified in ``URL format'', with name/value pairs that override command-line options on a per-compound basis. For example, the following would retrieve compound #1001 from a different table and columns than the defaults specified on the command line:

    dmol2image "id=1001&table=MOLFILES&idcolumn=ID&molcolumn=MOLFILE" >1001.png

Note that using this option, you can retrieve compounds from several different tables, or draw them with different sizes and/or colors, with a single command.

FastCGI Mode

If no key is supplied, the program goes into ``FastCGI web server'' mode, listening for web requests and generating images for web pages. See http://www.fastcgi.com/ to learn more about FastCGI programs.

In FastCGI mode, dmol2image maintains a single open connection to the relational database between requests for efficiency, so it is quite fast.

(Note: dmol2image is usually ``wrapped'' with a shell script, dmol2image.cgi, that sets environment variables and starts dmol2image with the command-line options specifying the database schema name, etc. The examples shown below make this assumption, and thus use dmol2image.cgi rather than dmol2image in the URL.)

Each request for an image is made as an ordinary HTTP request using a standard URL. Options (described in more detail below) are supplied in the URL as name=value pairs. For example, the following would override the default colorscheme and use white-on-black for the image:


When specifying options, you must use the long option name (e.g. ``colorscheme=wob'', not ``c=wob'').


Except where noted, all options can be used either on the command line, or in FastCGI mode in the URL as name=value pairs, for example:


--help, -v, --version, --usage
Print a summary of options and usage, then quit. Overrides all other options.

--format gif | png | jpg
Specifies what type of file is to be produced, GIF, PNG or JPEG. Default is PNG.

--quality NN
For JPG images only: Specifies the 'quality'. Must be a number between 1 and 100. Low numbers are smaller files, but lower quality, high numbers are larger files, better quality. (Default: 75)

--transparent yes | no
If ``transparent'' is ``yes'', uses a transparent background for GIF or PNG images (ignored for JPG images). This has the effect of drawing the atoms and bonds on top of the background color or texture of the web page. (Default: no)

(NOTE: Incredibly, Internet Explorer can't show transparent colors in PNG images. They are shown non-transparent. Other browsers such as Firefox will show the transparent images correctly.)

-f, --fontpath
Specify TrueType font path. If no TrueType font is given, uses a built-in set of four fixed-sized fonts, which are usable but less attractive than TrueType fonts.

-w , --width
Image width in pixels (default: 300)

-h, --height
Image height in pixels (default: 200)

-c, --colorscheme
cob, cow, bow, wob, for color-on-black, color-on-white, etc. These are actually filenames in the colorscheme directory, e.g. ./colorscheme/blue_theme would be '-c blue_theme'. Other colorschemes can be created in a subdirectory called 'colorscheme' in the current directory. Colorscheme names must be lowercase. Uses black-on-white if the named colorscheme can't be found. (default: black-on-white)

-b, --basename
Causes output to be written to one or more files rather than stdout, when several files are specified on the command line. File names are generated from the input structure's name (or ID, in the case of a database retrieval), and this name is concatenated with the value from --basename. For example:
    mol2image --basename /tmp/my_ a.sdf b.sdf

would create two files, /tmp/my_a.png and /tmp/my_b.png. Note that no trailing '/' is inserted, i.e. --basename /tmp will probably not do what you expect. This option is required when more than one input file is specified. If the program operates in FastCGI mode, it is ignored. The default (for a single file) is to write to stdout.

-u, --user
Specify the database user. Overrides the environment variable MC_MOL2IMAGE_USER.

NB: You should not use this option in most cases. Use the Environment variable MC_MOL2IMAGE_USER instead (see below).

-p, --password
Specify the database password. Overrides the environment variable MC_MOL2IMAGE_PASSWORD.

NB: You should not use this option in most cases. Use the Environment variable MC_MOL2IMAGE_USER instead (see below).

-S, --SID
Specify the database SID. Overrides the environment variable MC_MOL2IMAGE_SID (and overrides ORACLE_SID).

-t, --table
Specify the Oracle table name from which MOL files will be retrieved.

-i, -idcolumn
Specify the key column used to select the molfile.

-m, -molcolumn
Specify the CLOB column that holds the MOL file.


Specifies the username for logging in to Oracle. (See also --user above.)

Specifies the password for logging in to Oracle. (See also --password, above.)

Specifies the SID for connecting to Oracle. Overrides the standard Oracle environment variable ORACLE_SID. You may also have to set the environment variable TNS_ADMIN; see your Oracle administrator for more information. (See also --SID, above.)


the Modgraph Imaging Suite main page

the mol2image main page

the smi2image main page

the reg2image main page