scaling images

User 7b87cb2f6e

20-06-2010 17:02:09

Hi there,


I try to use marvin sketch for some days now and it's doing almost anything I want it to, I just have a scaling problem when saving images. Let's say I want to save a benzene molecule. I go to marvin view, it scales automatically and I save it. Now I want to do the same thing with anthracene, but KEEP the ring size, making the image a little bigger. Marvin view just keeps the image size and makes the molecule smaller. Is it possible to save several molecules differing in size, but keep the bond lengths the same in the final pictures??


If that would work I wouldn't have to copy a .jpg via the context menue into gimp, where it (no matter if I have one benzene ring or 25) keeps the bond lengths the same, just making the image bigger.  Like that it works, but it is a little cumbersome.


Cheers



Ewi

User 870ab5b546

21-06-2010 18:43:17

You can do it via the API:


final InputStream ip = new ByteArrayInputStream(molStruct.getBytes());
final DataOutputStream op = new DataOutputStream(new FileOutputStream(imgfile));
final MolConverter mcv = new MolConverter(ip, op, "jpeg:scale40", false);
mcv.convert();
op.close();
ip.close(); 

User 7b87cb2f6e

21-06-2010 21:01:23

Hi bobgr,


Thank you for your help! Unfortunately I don't really know what to do with your answer. Where am I supposed to enter your code? In a terminal in the command line? Will this change my problem permanently or do I have to do this every time I save a picture? As you see I'm quite new to these things... Any help is much appreciated.


Ewi

User 870ab5b546

21-06-2010 21:15:35

You would make these lines part of a Java program, which you could then execute from the terminal command line, if you wish.  If this is Greek to you, it's unlikely to be a suitable solution to your problem, but you might want to talk to a computer programmer colleague about it.

User 7b87cb2f6e

22-06-2010 17:36:39

Hmm I suspected something like that... nope, I have no idea of Java, but I know someone who has.  One might think there is an easier way to solve this. Isn't it quite common to display structures with equal bond lengths in several pictures? Anyway thank you very much for your Help!!!

ChemAxon 5433b8e56b

22-06-2010 23:09:01

Hi Ewi,


as i suspect you want to draw a molecule and save it to an image with similar c-c bond length. If i'm right then you should use MarvinSketch, where you can save the structure not just as a structure file, but as an image file also.


If you want to edit the structures, of course it is recommended to save also in a molecule file format.


You can save the structure as an image if you choose Save as image in the File menu of MarvinSketch just as in MarvinView. There you can set the file name, and after that some parameter of the image. Unfotrtunatelly i found a problem in the current release with this function, where the image size is being set improperly on the configuration panel and it contains the actual size of the visible part of the drawing Canvas not the required size for the sturcture. We will try to fix it in the next release.


Until that time, you can use the Copy as function on the right click menu after selecting the whole structure, use any of the image formats, and paste it into an image editor for example in MSPaint. In this case the image size won't be a problem.


The Save as image has a configuration panel where you can set the scale which is used in the image, the Copy as functionality is using the scale that was set for the MarvinSketch.


Best regards,
Istvan