Hello,

On Fri, Jul 30, 2010 at 6:51 AM, Greg Landrum <[email protected]> wrote:
> Dear all,
>
> This morning I had the chance to look at this on a machine with cairo 
> installed.
>
> There were a couple of problems that were making this happen.
>
> Uwe caught the first already: the convertColor() function was
> returning the wrong values.
>
> The second problem was with using the cairoCanvas and a PIL Image
> (this is what rdkit.Draw.ShowMol() does): there the pixel order
> expected by the PIL Image and that being provided by the cairo canvas
> were different, so the red and blue channels were being swapped. I
> just checked a fix for both of these into svn.

I was reported a problem by a friend, and I think it could be related
to these latest changes.

With the svn trunk revision 1473 (current head revision) the following snippet:

from rdkit.Chem.AllChem import MolFromSmiles, Compute2DCoords
from rdkit.Chem.Draw import MolToImage
molecule = MolFromSmiles('c1ccccc1')
Compute2DCoords(molecule)
image = MolToImage(molecule, size=(250, 250),
                   kekulize=True, wedgeBonds=True,
                   highlightAtoms=[])
image.save('ciccio.png', 'PNG')

raises an exception on a couple of Linux machines (running Fedora 12 and 13):

Traceback (most recent call last):
  File "./testcase.py", line 8, in <module>
    highlightAtoms=[])
  File "/home/ric/ric/RDKit/rdkit-trunk/rdkit/Chem/Draw/__init__.py",
line 35, in MolToImage
    canvas = Canvas(img)
  File "/home/ric/ric/RDKit/rdkit-trunk/rdkit/Chem/Draw/cairoCanvas.py",
line 36, in __init__
    imgd = image.tostring("raw","BGRA")
  File "/usr/lib64/python2.6/site-packages/PIL/Image.py", line 516, in tostring
    e = _getencoder(self.mode, encoder_name, args)
  File "/usr/lib64/python2.6/site-packages/PIL/Image.py", line 389, in
_getencoder
    return apply(encoder, (mode,) + args + extra)
SystemError: unknown raw mode

The problem disappears when reverting rdkit/Chem/Draw/cairoCanvas.py
to the earlier repository revision.

My understanding of image formats, encodings and the graphics
subsystem is extremely limited so I don't know exactly which other
information could be useful to tracking the problem.. the installed
python imaging library is PIL 1.1.6. Are there other library revisions
I could check or dependencies I should verify are correctly solved?

Thanks in advance,

Best regards,
Riccardo

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to