Odd "+noise" "-modulate" and "-blur" result

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
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Odd "+noise" "-modulate" and "-blur" result

Post by GeeMack »

ImageMagick 7.0.4-3 on Windows 10 64: I'm working a command that uses "+noise", "-modulate", and "-blur". I ran into a combination that creates an odd result, and I narrowed it down to a very short command to test the issue...

Code: Select all

magick logo:[400x] -alpha set +noise poisson -modulate 100 -blur 0x1 noise_poisson.png
The output of that command is covered with small black squares...

Image

If I omit "-alpha set", the output image is all black.

If I use "+noise" with any types other than "poisson", the issue doesn't occur.

If I omit either the "-modulate" or "-blur", the black squares won't be there. If I switch their order by putting the "-blur" before the "-modulate", the squares don't appear. It doesn't seem to matter what modulate settings I use. The squares do appear with blur settings other than "0x1", including "0x0", but will be different sizes of small black squares depending.

I can easily avoid using this construct for my purposes, but if someone has a need for that particular combination of operations, the black squares don't seem like an expected result. Is it a bug, or have I overlooked something?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Odd "+noise" "-modulate" and "-blur" result

Post by fmw42 »

I get perfectly fine looking noisy images at each stage on IM 6.9.7.2 and IM 7.0.4.2 Q16 Mac OSX using the command below.

Code: Select all

magick logo:[400x] +noise poisson +write tmp1b.png -modulate 100 +write tmp2b.png -blur 0x1 tmp3b.png
I will download and test with the latest versions and report back.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Odd "+noise" "-modulate" and "-blur" result

Post by fmw42 »

It seems to work fine for me also on IM 6.9.7.3 and IM 7.0.4.3 Q16 Mac OSX
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Odd "+noise" "-modulate" and "-blur" result

Post by GeeMack »

fmw42 wrote: 2017-01-11T14:38:09-07:00It seems to work fine for me also on IM 6.9.7.3 and IM 7.0.4.3 Q16 Mac OSX
I've tried it with IM 6.9.6-0 Q16 HDRI and IM 7.0.4-3 Q16 HDRI on Windows 10 x64, and the output image from each has the black squares. When I try your test command...

Code: Select all

magick logo:[400x] +noise poisson +write tmp1b.png -modulate 100 +write tmp2b.png -blur 0x1 tmp3b.png
... the two intermediate images "tmp1b" and "tmp2b" are as expected. The output "tmp3b" has the squares. Might be a Windows specific issue.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Odd "+noise" "-modulate" and "-blur" result

Post by magick »

HDRI-enabled ImageMagick allows image pixels to exceed the quantum range, typically 0-65535, including going negative. Your command should return proper results with the -clamp option:

Code: Select all

magick 'logo:[400x]' +noise poisson -clamp +write tmp1b.png -modulate 100 +write tmp2b.png -blur 0x1 tmp3b.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Odd "+noise" "-modulate" and "-blur" result

Post by fmw42 »

To clarify, all my tests above were without HDRI.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Odd "+noise" "-modulate" and "-blur" result

Post by GeeMack »

magick wrote: 2017-01-11T15:44:02-07:00HDRI-enabled ImageMagick allows image pixels to exceed the quantum range, typically 0-65535, including going negative.
That helps me understand a few issues I've encountered. Thanks!
Post Reply