Page 1 of 1

How do you set the seed?

Posted: 2019-04-15T17:14:48-07:00
by Lunar Eclipse
Hello!

I'd like to be able to reuse a plasma fractal that was generated. It looks like you can change the seed in ImageMagick, but how do you do it with Imagick?

The code:

Code: Select all

$test = new Imagick();
$test->newPseudoImage(400, 400, 'plasma:fractal');
$img->compositeImage($test, Imagick::COMPOSITE_ATOP, 0, 0);
More details: Plasma fractals generate nifty images that change when I refresh the script. I would like them to not change (without having to save the images to my server) by being able to conrol whatever value is being randomly generated. This would allow me to reuse previously generated fractals.

Re: How do you set the seed?

Posted: 2019-04-15T19:31:44-07:00
by fmw42
Not sure that Imagick has that implemented. You can try via setImageArtifact or setImageAttribute or setImageProperty and see if one of those works.

Re: How do you set the seed?

Posted: 2019-04-16T04:39:00-07:00
by magick
The MagickCore method to set the seed is SetRandomSecretKey(). It cannot be set as an environment variable, artifact, attribute, or property. You could try downloading the iMagick source and searching for SetRandomSecretKey() to see if setting is supported.

Re: How do you set the seed?

Posted: 2019-04-16T09:34:21-07:00
by fmw42
I cannot find that or any other way to set it in Imagick. setRandomeSecretKey() does not exist in Imagick as best I can tell. I cannot find anything related to seeds for random numbers or functions that would need it, such as addNoiseImage