POV-Ray : Newsgroups : povray.newusers : Save an image to disk from code. Server Time
28 Mar 2024 05:48:13 EDT (-0400)
  Save an image to disk from code. (Message 1 to 5 of 5)  
From: alessio diluzio94@gmail com
Subject: Save an image to disk from code.
Date: 23 Oct 2019 09:55:00
Message: <web.5db05b13151061f9ad6bf02d0@news.povray.org>
Hello everybody.
I'm using rand to generate image with different random sizes, i have to draw
wires and i choose randomly start and end points.
I want to draw different multiple images in "automatic" way.
For example if a want to draw 100 images i wuold like to know if it is possibile
to iterate in my script 100 times and save from code the different 100 generated
images in the script.


Post a reply to this message

From: Dick Balaska
Subject: Re: Save an image to disk from code.
Date: 23 Oct 2019 12:42:07
Message: <5db082df@news.povray.org>
On 10/23/19 9:53 AM, ale### [at] gmailcom wrote:
> Hello everybody.
> I'm using rand to generate image with different random sizes, i have to draw
> wires and i choose randomly start and end points.
> I want to draw different multiple images in "automatic" way.
> For example if a want to draw 100 images i wuold like to know if it is possibile
> to iterate in my script 100 times and save from code the different 100 generated
> images in the script.
> 
> 
> 

You could do it as an animation. All of the images would have to be the 
same size, but they could each have completely different content.

commandline: +sf1 +ef100 +ff100

code:
#switch(frame_number)
   #case(1)
     // build picture 1
     #break
   #case(2)
     // build picture 2
     #break
#end

-- 
dik
Rendered 15941836800 of 40928716800 pixels (38%)


Post a reply to this message

From: alessio diluzio94@gmail com
Subject: Re: Save an image to disk from code.
Date: 24 Oct 2019 04:45:00
Message: <web.5db16242c9a81388ad6bf02d0@news.povray.org>
Dick Balaska <dic### [at] buckosoftcom> wrote:
> On 10/23/19 9:53 AM, ale### [at] gmailcom wrote:
> > Hello everybody.
> > I'm using rand to generate image with different random sizes, i have to draw
> > wires and i choose randomly start and end points.
> > I want to draw different multiple images in "automatic" way.
> > For example if a want to draw 100 images i wuold like to know if it is possibile
> > to iterate in my script 100 times and save from code the different 100 generated
> > images in the script.
> >
> >
> >
>
> You could do it as an animation. All of the images would have to be the
> same size, but they could each have completely different content.
>
> commandline: +sf1 +ef100 +ff100
>
> code:
> #switch(frame_number)
>    #case(1)
>      // build picture 1
>      #break
>    #case(2)
>      // build picture 2
>      #break
> #end
>
> --
> dik
> Rendered 15941836800 of 40928716800 pixels (38%)

My problem is i don't know how to code "build picture".
Is it possibile to use a for statement insted of a switch to build multiple
picture?


Post a reply to this message

From: Dick Balaska
Subject: Re: Save an image to disk from code.
Date: 24 Oct 2019 06:25:48
Message: <5db17c2c$1@news.povray.org>
On 10/24/19 4:35 AM, ale### [at] gmailcom wrote:

> 
> My problem is i don't know how to code "build picture".
> Is it possibile to use a for statement insted of a switch to build multiple
> picture?
> 
> 

The output of povray is a graphics file which is the result of its 
calculations.  The input is a script of POV-Ray SDL (Scene Description 
Language).

That is it.

Now, POV-Ray can be coerced to into outputting several graphics file. 
This is accomplished by basically POV-Ray calling itself once for each 
frame, or graphics file outputted.

It starts over at the beginning of your SDL script for each and every 
frame output.

A for loop is the wrong paradigm (the SDL does not control which 
graphics files are output).

If you are using POV-Ray for Windows or qtpovray, the include menu 
contains two samples under the Animation sub-menu which will build 
complete scenes.  Start with "animation 1".

-- 
dik
Rendered 17306265600 of 40928716800 pixels (42%)


Post a reply to this message

From: Alain Martel
Subject: Re: Save an image to disk from code.
Date: 25 Oct 2019 10:57:15
Message: <5db30d4b$1@news.povray.org>
Le 2019-10-23 à 09:53, ale### [at] gmailcom a écrit :
> Hello everybody.
> I'm using rand to generate image with different random sizes, i have to draw
> wires and i choose randomly start and end points.
> I want to draw different multiple images in "automatic" way.
> For example if a want to draw 100 images i wuold like to know if it is possibile
> to iterate in my script 100 times and save from code the different 100 generated
> images in the script.
> 
> 
> 

Use the animation feature.

You can use frame_mumber to seed your random stream :

#declare R= seed(frame_number);

You also can  use the clock variable :

#declare R= seed(clock*1000);

In both cases, you can add some constant. You can combine both :

#declare R= seed(frame_number*2+12 + clock*100+3);

Use rand(R) in your scene.

Then, place +kff100 on the command line.
For the Windows version, the command line is the text box just to the 
right from the resolution selector.
Hit the Run button and you'll get 100 uniquely numbered images. The 
number is frame_number.



Alain


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.