Particular generation time of imagemagick and Fred script

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Particular generation time of imagemagick and Fred script

Post by badabou »

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.
User avatar
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

Post by fmw42 »

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.
It is not an ImageMagick problem, but one of using a script in place of a single true compiled function.

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.
User avatar
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

Post by anthony »

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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
badabou
Posts: 54
Joined: 2008-06-23T06:12:24-07:00

Re: Particular generation time of imagemagick and Fred script

Post by badabou »

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.
Post Reply