I have a large number of peptides. Is it possible to save a peptide structure in Pymol in PNG formally without having any extra spaces around it? I am using Pymol in Python to save the peptide PDB file in PNG format.
I am not sure if I get your question right! However, if I understand it correctly. I think it is a matter of dimensions (width and height). and using "ray" command you can change the space around the peptide.
You can use the zoom command in PyMol to scale your molecule such that it fills the window with a specified number of Ångstrom of buffer space around it.
zoom [ selection [,buffer [, state [, complete ]]]]
https://pymolwiki.org/index.php/Zoom
If you set the buffer to 0, you have no space around it, but you may want to specify
set orthoscopic, on
to turn off perspective, as this may interfere with the exact fit depending on the Z position of your molecule
The github version of PyMol is open source, therefore free to use.
"PyMOL is a commercial product, but we make most of its source code freely available under a permissive license. The open source project is maintained by Schrödinger and ultimately funded by everyone who purchases a PyMOL license. Open source enables open science. This was the vision of the original PyMOL author Warren L. DeLano."
https://github.com/schrodinger/pymol-open-source
However, with this version you have all the hassle of having to compile it, including all the dependencies: https://github.com/schrodinger/pymol-open-source/blob/master/INSTALL
With the incentive version, you get a hassle-free pre-compiled installation package. In the free edu-version, ray-tracing is disabled (no shadows, reflections), while you can still use the png command to export images at any resolution desired: