Hello,
I have a problem with a script by Fred :
http://www.fmwconcepts.com/imagemagick/3Dbox/index.php
On the site of lunapic, the generation time of 3d animated cube is less than 2 seconds while on my server (Bi Dual Xeon 8x2Ghz) time is greater than 60 seconds :
http://www.lunapic.com/editor/?action=cubeanim
How to explain such a difference ?
Thank you and sorry for my English.
Particular generation time of imagemagick and Fred script
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Particular generation time of imagemagick and Fred script
It is not an ImageMagick problem, but one of using a script in place of a single true compiled function.badabou wrote:Hello,
I have a problem with a script by Fred :
http://www.fmwconcepts.com/imagemagick/3Dbox/index.php
On the site of lunapic, the generation time of 3d animated cube is less than 2 seconds while on my server (Bi Dual Xeon 8x2Ghz) time is greater than 60 seconds :
http://www.lunapic.com/editor/?action=cubeanim
How to explain such a difference ?
Thank you and sorry for my English.
My 3dbox script has to do a lot of unix calculations to set up and rotate vertices, compute surfaces and test the surfaces for back facing and front facing. These take a lot of time as they are not part of the IM function -distort perspective and so are not compiled. Then -distort perspective has to be called multiple times, once for each face and the faces composited together. It is not a nice and neat compiled function, but a script that mixes unix calculations with a few IM functions. If you then animate it, the time inefficiencies get multiplied N time to slow it even further. Plus all the frames have to be duplicated as they are written to a gif animation. My script was not necessarily written with efficiency in mind, but could probably be tuned up to be more efficient. However, it will never achieve the same efficiency as a single true compiled function.
Lunapic probably has this all compiled into a single neat function and likely does it all in memory with no temporaries files written to disk.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Particular generation time of imagemagick and Fred script
You may also like to look at 3D Boxes, Affine Layering which shows how it can be done. Of course you still need calculations for the coodinates desired.
There is also an example of using Shears to generate a 3d Cube, that was developed and first exampled by Wolfgang Hugemann. It is shown again as part of his Windows Batch Scripting contribution to IM. Note however that this is even hard to do for any angle as its mathematics is not as precise.
There is also an example of using Shears to generate a 3d Cube, that was developed and first exampled by Wolfgang Hugemann. It is shown again as part of his Windows Batch Scripting contribution to IM. Note however that this is even hard to do for any angle as its mathematics is not as precise.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Particular generation time of imagemagick and Fred script
Thank you very much for your responses.
I now understand how to optimize the scripts Fred.
Thank you very much for your script Fred and thank you designers imagemagick.
I now understand how to optimize the scripts Fred.
Thank you very much for your script Fred and thank you designers imagemagick.