Possible bug in +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

Possible bug in +noise random

Post by fmw42 »

I have had success with generating random noise images in previous version 6.3.7.x, but I am having trouble with IM 6.3.8-6 Q16 on Mac OS X Tiger.

When I do:

convert logo: -colorspace Gray +noise Random logo_random.png

I get a totally black image.

when I do

convert logo: -colorspace Gray +noise Uniform logo_uniform.png

or

convert logo: -colorspace Gray +noise Gaussian logo_gaussian.png

I see an image but it is visually no different from

convert logo: -colorspace Gray logo_gray.png

compare -metric rmse logo_gray.png ogo_uniform.png null:

gives a small error, but it is not visually perceptive.

Also Anthony's example:

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

and

convert -size 100x100 xc: -fx 'rand()' random_fx.png

also produce a totally visual black image and not what he shows on his examples page.

As a further question, is there any way to control the statistics of the random noise levels, e.g. values nominally range from 0 to 1, but what if I want it to vary only from .3 to .7. Can this be controlled with any advanced SET option?

Thanks.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible bug in +noise random

Post by magick »

You ran across a transient bug that is fixed in the latest release. We strengthened random number generation when we introduced enciphered pixels but also introduced a bug which has been fixed in the latest release, 6.3.8-10.
is there any way to control the statistics of the random noise levels, e.g. values nominally range from 0 to 1, but what if I want it to vary only from .3 to .7. Can this be controlled with any advanced SET option?
Why not use '(0.4*rand()+0.3)' in your -fx expression?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible bug in +noise random

Post by fmw42 »

Why not use '(0.4*rand()+0.3)' in your -fx expression?
Yes that would work for random noise (but fx is slower than +noise). But how do I handle that for Uniform or Gaussian noise or any other type that you have in +noise? Are there any advanced user settings for +noise that would accommodate that? Alternately, how would one produce uniform or gaussian noise with -fx?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible bug in +noise random

Post by magick »

Currently there is no user controls for random noise. Adding control to random noise is already on our To-Do list.
Post Reply