How do I use -seed with +noise Random

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

How do I use -seed with +noise Random

Post by fmw42 »

How do I specify a new seed when generating a random noise image? For example:

convert -size 100x100 xc: -seed +noise Random tmp.png

returns error:
convert: invalid argument for option `+noise': -seed @ convert.c/ConvertImageCommand/2194.


Is this a bug or am I not using it correctly?

IM 6.4.7-10 Q16 Mac OSX Tiger
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How do I use -seed with +noise Random

Post by magick »

How do I specify a new seed when generating a random noise image? For example:
Try this command:
  • convert -size 100x100 xc: -seed 171713 +noise Random tmp.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I use -seed with +noise Random

Post by fmw42 »

magick wrote:
How do I specify a new seed when generating a random noise image? For example:
Try this command:
  • convert -size 100x100 xc: -seed 171713 +noise Random tmp.png

OK, perhaps I misunderstand. If I leave off the -seed, and create two random images with two separate command lines, will the two images be the same random pattern or differerent? Are you changing the seed on each command line in some way and if so using what key for the seed?


convert -size 100x100 xc: +noise Random tmp1.png
convert -size 100x100 xc: +noise Random tmp2.png

My tests seem to show different patterns. So perhaps I don't need to use -seed.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How do I use -seed with +noise Random

Post by magick »

The random images will always differ if a seed is not specified or if two commands have different seeds (i.e. -seed 17171 and -seed 17172). If the seeds are the same, the resulting images will be the same.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I use -seed with +noise Random

Post by fmw42 »

magick wrote:The random images will always differ if a seed is not specified or if two commands have different seeds (i.e. -seed 17171 and -seed 17172). If the seeds are the same, the resulting images will be the same.

If one does not set the seed and leaves it to IM to do for example with

convert -size 100x100 xc: +noise Random tmp.png

is there some way to get IM to report the seed value to the terminal, so that the same value can be used again with -seed to reproduce the same pattern?

I tried adding -verbose, but that did not report the seed value.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How do I use -seed with +noise Random

Post by magick »

There is no way to determine the seed value unless you set it yourself.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I use -seed with +noise Random

Post by fmw42 »

magick wrote:There is no way to determine the seed value unless you set it yourself.
OK. Then any restrictions on the value that can be used for the seed? for example, must it be an integer between 0 and quantumrange?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How do I use -seed with +noise Random

Post by magick »

The seed can be any 32-bit value.
Post Reply