Hi Rolf
I am a real noob when it comes to Jmol and scripting the only codes I've
ever implemented I've had to ask about on here, first, so I have
absolutely no idea as to how to implement this code, all I want is an
animated 3D GIF with a transparent background via whatever mechanism ya
can think of for me, provided it isn't like too tedious (which I define
as taking like >30 mins per GIF). I understand the size X and size Y, as
they're the width and height of the GIF files I want (or so I think,
correct me if I am wrong), respectively.
By the way, thanks for your help in case I haven't already said it, I do
appreciate it.
Thanks for your time,
Brenton
On 15/10/2014 4:37 AM, Rolf Huehne wrote:
> On 10/13/2014 06:16 PM, Rolf Huehne wrote:
>> To get rid of the last pink pixels and to reduce the manual work even
>> more export as PNG with transparent would be better.
>>
> I have written a Jmolscript function that facilitates exporting PNG
> files for an animation:
>
> function exportAnimation(baseFilename, sizeX, sizeY, stepCount,
> stepCommandSet) {
> var printFormat = "" + baseFilename + "_%0" + stepCount.length + "d.png";
> var savedBackgroundColor = backgroundColor;
> background [x101010];
> for (var i=1; i<=stepCount; i++) {
> var filename = format(printFormat, i);
> var writeCommand = "write IMAGE " + sizeX + " " + sizeY + " PNGT 9
> " + fileName;
> var dummy = script(writeCommand);
> dummy = script(stepCommandSet);
> }
> background @savedBackgroundColor;
> }
>
> Here is an example call that will generate 72 PNG images
> (jmol_movie_01.png, jmol_movie_02.png,...) with transparent background
> (500x500 pixel) where the molecule does a full 360 degree rotation in 5
> degree steps:
>
> exportAnimation("jmol_movie", "500", "500", "72", "rotate axisangle {1 1
> 0} 5");
>
> The 'stepCommandSet' parameter can contain any set of Jmolscript
> commands separated by semicolon. They are executed each time after an
> image is written.
>
> The background color is set here temporarily to the color proposed in
> the documentation as example for writing PNGT images. I have done this
> because not all background colors seem to work. "white" for example did
> result in a white background color instead of a transparent one in the
> exported images (Jmol 14.3.7).
>
> In the applet unfortunately a file select dialog box pops up for every
> PNG file. I guess this is a security measure from the browser and you
> will not be able to avoid it.
> Bob, the compression factor set in the dialog box ignored the setting
> from the command (in Firefox 32 on Linux). Fortunately it was at least
> remembered for the other images after it was changed within the dialog box.
>
> With GIMP you can now very easily generate an animated GIF file in only
> four steps:
>
> 1) Create a new image (RGB mode) with the same size as the PNG images
> (500 x 500 pixel in the example above)
>
> 2) Add all PNG files in a single step with "File->Open as layers" from
> the menu. You should be able to select all files by selecting the first
> file with the mouse and the last file with SHIFT-mouseclick. Make sure
> that they are ordered by name. Otherwise you would have to reorder the
> layers later.
>
> 3) Delete the empty background layer at the bottom. (It was created in
> step 1.)
>
> 4) Export the image as GIF file and set the paramters in the dialog box
> that should appear after you selected the filename according to your
> liking for the animated GIF.
>
> If you would also save the image in XCF format you could keep the full
> color information there. The conversion to "indexed" mode is done
> automatically just for the saved GIF image. You could also do it
> manually before saving as GIF. Then you would have some control over the
> conversion parameters.
>
> Regards,
> Rolf
>
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users