+Noise/-Noise help

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
distortioness
Posts: 2
Joined: 2019-07-13T20:49:51-07:00
Authentication code: 1152

+Noise/-Noise help

Post by distortioness » 2019-07-13T20:54:40-07:00

Hi, I'm new to Imagemagick and am trying to learn this without much knowledge of coding, etc.

I have "image.bmp" that I have added noise to: convert image.bmp +noise random image_noise.bmp
and I get the noise field...great. Now, how do I UNDO what I just did? I tried -noise which asks for a radius
and I've entered 0, 1, 2, etc. but nothing changes. What method do I use to now remove the noise from the image
basically undoing what I just did?

Thanks.

User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: +Noise/-Noise help

Post by fmw42 » 2019-07-13T22:22:32-07:00

Imagemagick has no inverse of adding noise. Once noise is added to an image, you lose data in the image. There are techniques to mitigate that, but you cannot perfectly recover the image. Typically those techniques work best for Gaussian noise. For well separated noise, things like the median filter might help. Also see the -enhance and -despeckle Imagemagick functions that can help for some kinds of noise. Dense random noise is very hard to remove when using +noise random because it totally covers every pixel in the image. It is not simply added to the image. See https://imagemagick.org/Usage/canvas/#random_noise. Also see http://www.imagemagick.org/script/comma ... php?#noise for noise mitigation.

For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli

Please always provide your IM version and platform when asking question since syntax and scripting may differ. Also post your example images to some free hosting service and put the URLs here, so we can see exactly what you are doing.

I presume you are on Windows, if you are using BMP files.

For Unix-based system users, I have some noise mitigating scripts. See my scripts at my link below.

snibgo
Posts: 12157
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: +Noise/-Noise help

Post by snibgo » 2019-07-14T05:19:35-07:00

As Fred says, "+noise random" replaces every pixel with noise. No trace exists of the original image, so it can't be undone.
distortioness wrote:What method do I use to now remove the noise from the image basically undoing what I just did?
Adding noise and then removing it is a strange requirement. What are you actually trying to do? Perhaps it can be done some other way.
snibgo's IM pages: im.snibgo.com

distortioness
Posts: 2
Joined: 2019-07-13T20:49:51-07:00
Authentication code: 1152

Re: +Noise/-Noise help

Post by distortioness » 2019-07-14T17:34:44-07:00

I see. Thank you. I'll try something else and I'll update when I figure out the posting stuff. I appreciate it!!

User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: +Noise/-Noise help

Post by fmw42 » 2019-07-14T17:40:21-07:00

You can see some examples of noise mitigation from my scripts example pages. That will show you what can be done. If you are on Windows, then my scripts will not work unless you use Windows 10 Unix or Cygwin. But at least you will get some idea what can be done and how well.

Post Reply