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





reg2image - molecular images of Modgraph Registry molecules

    reg2image [options] [key ...]


Reads a molecular structure from the Modgraph Registry database and draws it as an image. Uses styles and annotations that are specific to the Modgraph Registry system. Images can be GIF, JPG or PNG format.

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

Command-line mode

If registry keys (a PCN, Registry Number, or Lab Notebook Number) are supplied on the command line, reg2image 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.

By default (without -b or --basename), a single key can follow the options on the command line, and the image is written to standard output. The key can be a simple PCN, REGNO or LNB. For example:

    reg2image MG100A >file.png

If -b (--basename) is specified, reg2image creates a series of files by concatenating basename and key. Example:

    reg2image -b /tmp/my_ MG100A RAM/101 MG101A

would create three files in /tmp, called my_MG100A.png, my_RAM_101.png and my_MG101A.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 '_'.

A command-line <key> can also override the default database name using name-value pairs; for example, the following would create two image files in the /tmp directory, MC1000A.png from the default registry, and registry2_MC100A.png from the schema called 'registry2':

    reg2image -basename /tmp/ MC1000A "regno=MC1000A&database=registry2"

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, reg2image maintains a single open connection to the relational database between requests for efficiency, so it is quite fast.

(Note: reg2image is usually ``wrapped'' with a shell script, reg2image.cgi, that sets environment variables and starts reg2image with the command-line options specifying the database schema name, etc. All of the examples shown below make this assumption, and thus use reg2image.cgi rather than reg2image 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. This option can only be specified on the command line.

--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. Default is ``./helvetica.ttf''. 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. Note that if a relative path is used (e.g. ``./courier.ttf''), it is relative to the fcgi-bin directory where the CGI resides. This option can only be specified on the command line.

-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, for example ./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. If no colorscheme is specified, or if the specified colorscheme can't be found, black-on-white is used.

-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.

-d, --database
Specify default Modgraph registry name (default: 'registry')

-s, --server
Specify default Oracle server hostname (default: 'localhost')

-S, --SID
Specify default Oracle SID (default: '')


the Modgraph Imaging Suite main page

the mol2image main page

the dmol2image main page

the smi2image main page