For SVG:

extern "C" char *
ob_molfile_to_svg (char *molfile)
{
    OBMol mol;
    OBConversion conv;
    string tmpStr (molfile);
    string outstring;
    istringstream molstream (tmpStr);
    ostringstream SVGstream;
    char *tmpSVG;

    conv.SetInAndOutFormats ("MDL", "SVG");

    conv.Read (&mol, &molstream);

    if (mol.Empty ())
        return NULL;

    conv.Write (&mol, &SVGstream);

    outstring = SVGstream.str ();

    tmpSVG = strdup (outstring.c_str ());

    return (tmpSVG);
}

best regards,

Ernst-Georg

Von: KC soh [mailto:kengc...@gmail.com]
Gesendet: Donnerstag, 9. Februar 2012 12:06
An: openbabel-discuss@lists.sourceforge.net
Betreff: [Open Babel] Message-ID: <4f2ff94c.2070...@gaseq.co.uk>

Hi Chris

I would like to export/convert a molfile to SVG or PNG format using C++ 
interface. Is there anywhere i can get an example of how to do it?

Thank you.

best rgds


Message: 2
Date: Mon, 06 Feb 2012 16:01:16 +0000
From: Chris Morley <c.mor...@gaseq.co.uk<mailto:c.mor...@gaseq.co.uk>>
Subject: Re: [Open Babel] MOL to PNG?
To: 
openbabel-discuss@lists.sourceforge.net<mailto:openbabel-discuss@lists.sourceforge.net>
Message-ID: <4f2ff94c.2070...@gaseq.co.uk<mailto:4f2ff94c.2070...@gaseq.co.uk>>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 03/02/2012 16:56, KC soh wrote:

> I read that openbabel can read png to mol but would it be possible to then
> export the mol as png/svg/jpg formats? Is there somewhere i can find out
> how to do it with the C++ implementation?

Could you clarify what you are looking for?

OpenBabel can read (and write) molecule files, like MDL mol, that are
*embedded* in PNG files. Once the molecule has been read, OpenBabel
display it as SVG, PNG and in many chemical formats.

To deduce a chemical structure from the *image*, another program, like
OSRA http://cactus.nci.nih.gov/osra/, is required.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to