UberStudent Forums
http://uberstudent.com/phpBB/

GNU/Linux: Convert images to animations/movies (ex.: PyMOL)
http://uberstudent.com/phpBB/viewtopic.php?f=7&t=467
Page 1 of 1

Author:  David Baum [ Thu May 30, 2013 7:40 pm ]
Post subject:  GNU/Linux: Convert images to animations/movies (ex.: PyMOL)

1 - Create an image sequence using PyMOL
1.1 - What is PyMOL ?
1.2 - Get the structure of a protein from the Protein Data Bank
1.3 - Chose an animation for your protein
1.4 - Export the animation to an image sequence
2 - Convert your image sequence in movies
3 - Convert your image sequence in .gif animations
4 - Add .gif animations to LibreOffice Impress or Powerpoint presentations


1 - Create an image sequence using PyMOL
1.1 – What is PyMOL ?
PyMOL is a free (libre) and cross platform molecular graphics system that allows you to visualize protein structures. With this program you can label the atoms, bonds of interest and highlight chosen areas. It is often used to create high quality images for scientific publications and handles a broad range of file types.

1.2 - Get the structure of a protein from the Protein Data Bank
The Protein Data Bank concentrates all available informations about proteins whose structure have been identified.
Let's say you are interested in the Hen Lysozym. Under Download in the upper right download the .pdb.gz file and extract the contained .pdb file.
Attachment:
File comment: See the download option .pdb.gz on the right
PDB file download HL.png
PDB file download HL.png [ 163.45 KiB | Viewed 13274 times ]

In order to open the file in PyMOL the path to the file must not contain any spaces !
(WRONG : /home/user/downloads/my pdb files/, RIGHT : /home/user/downloads/my_pdb_files/)

1.3 - Chose an animation for your protein
Start PyMOL and open the file via File → Open. You see the protein appear in an extra window. In the control window above go to Movie → Program → Camera loop and chose an animation (for ex. the y-roll).
The program let's you chose the speed of the animation and you can set the framerate (Movies → Framerate). The higher the framerate the more images will be saved and the bigger the movie/animation will be. 8 seconds for the scene and 15 fps is a good choice.

1.4 - Export the animation to an image sequence
Go to File → Save Movie AS → PNG images …
Note that it is better to chose a new folder to save the images in as there will be more than 200 images saved. The images will be numbered automatically.


2 - Convert your image sequence in movies
This step is really easy in GNU/Linux, just open the terminal an go the folder you saved the images in (for example /home/user/downloads/my_pdb_files/firsttry/) by
Code:
cd /home/user/downloads/my_pdb_files/firsttry/

and convert the images to .mpeg by
Code:
convert *.png NameOfChoice.mpeg

By typing *.png all the .png files in the folder will be converted into the same .mpeg file, so male sure there are no other .png files in the folder.

3 – Convert your image sequence in .gif animations
This step is similar to converting images to mpeg. Instead of convert *.png NameOfChoice.mpeg
you type
Code:
convert *.png NameOfChoice.gif

Attachment:
File comment: Converting .png to .gif
Converting .png to .gif.png
Converting .png to .gif.png [ 71.67 KiB | Viewed 13274 times ]



4 - Add .gif animations to LibreOffice Impress or Powerpoint presentations
To add the animation to a slide go to Insert → Image → From file
Make sure you test your presentation once before presenting with LibreOffice as LibreOffice, other than Microsoft Office, loads slides one by one on the fly when changing the slides. A big animation will freeze your presentation for a couple of seconds. A good file size can be obtained with 15fps and 8s (approx. 4MB).


NOTES
1) The converting process can take a long time. Converting 240 images of 102KB took me 5 minutes with a Pentium 4 2x 2,9GHz 32Bit.
2) A good way to decrease the file size is to decrease the duration of the animation and to set the framerate to the lowest.


Feel free to give feedback or corrections, please.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/