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: 24568
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 » 2008-12-20T18:23:32-07:00

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: 10912
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick » 2008-12-20T19:29:45-07:00

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: 24568
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 » 2008-12-21T13:38:36-07:00

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: 10912
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick » 2008-12-21T15:08:05-07:00

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: 24568
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 » 2008-12-21T15:32:54-07:00

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: 10912
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick » 2008-12-21T16:08:18-07:00

There is no way to determine the seed value unless you set it yourself.

User avatar
fmw42
Posts: 24568
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 » 2008-12-21T16:49:35-07:00

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: 10912
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick » 2008-12-21T16:57:20-07:00

The seed can be any 32-bit value.

Post Reply