How do you set the seed?

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
Lunar Eclipse
Posts: 1
Joined: 2019-04-15T17:08:35-07:00
Authentication code: 1152

How do you set the seed?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do you set the seed?

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How do you set the seed?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do you set the seed?

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