Reduce noise like Photoshop

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
slogra

Reduce noise like Photoshop

Post by slogra »

Hi, I've been searching for a program that can do resize, filtering and unsharp mask in a batch. Sound simple eh? However none of the programs that i found so far can do everything right. Photoshop has a nice filters, but lacks high quality resizing. Other programs like ifranview have a nice resize (lanczos) but missing filter options. Yet other programs lack a batch process feature.
Right, now i'm doing filtering in photoshop and resizing in ifranview, which is not convinient at all, because i have to do stuff manually and intermediate files need to be saved/read.

I haven't played with ImageMagick yet, but i believe ImageMagick has high quality resize and batch features.
However I'm not sure about the filtering. I'm looking for a very similar filter as the Reduce Noise filter in Photoshop.
I'm not sure what this filter does exactly under the hood, but i really like it. The settings i use for this filter in Photoshop are:
- Strength 10
- Preserve detail 8
Other options are set to 0 or disabled.

In the end i want to batch process lots of huge pictures to smaller thumbs suitable for the web. What i would like the batch to do is the following:
- resize to 320*240 (i would like fairly large and detailed thumbs)
- apply noise filter
- do a subtle unsharp mask
- save to png and jpg

Other features that would like (but not a must) are: median filter and (auto) levels.

Another question i have is: Why are there differences in lanczos resizing? For example Irfanview looks quite different than Faststone. I prefer Irfanview because faststone gives ringing.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Reduce noise like Photoshop

Post by snibgo »

You can do all that in ImageMagick, including median and auto levels. I don't know how IM's noise reduction compares to Photoshop's -- I don't use PS, nor do I de-noise images.

You would have to play with IM to see what you like. For example:

Code: Select all

convert in.jpg -resize 320x240+0+0 -noise 5 -median 5 -unsharp 5 -normalize -write out.png out.jpg
You can specify the resize filter, if you want. I use the defaults, and have never experienced ringing.
snibgo's IM pages: im.snibgo.com
slogra

Re: Reduce noise like Photoshop

Post by slogra »

Alright, thanks, i will check it out as soon as i'm home. Your command line will give me a good start.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Reduce noise like Photoshop

Post by snibgo »

It's just an example, of course. The numbers I gave may give horrible results. Try out one option at a time, with different (probably smaller) numbers.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Reduce noise like Photoshop

Post by fmw42 »

You may also want to check out my isonoise and statsfilt noise filters which are unix bash scripts. see link below
slogra

Re: Reduce noise like Photoshop

Post by slogra »

So far so good. The resize and unsharp work perfectly. I've tried all different resize methods and i prefer Box for my needs. It is sharpest without ringing. The unsharp settings are exactly the same as in PS. I also played with the jpeg settings. This is what i used:

Code: Select all

convert in.jpg -filter Box -resize 320x320+0+0 -unsharp 0x1+0.25+0 -quality 86% -sampling-factor 1x1 -write out.png out.jpg
Try it, it looks awesome! imho :p. Maybe the file is a bit big for a thumb, but i don't care.

I haven't tried noise filtering yet, which will probably be a little harder to do. Fmw42, i will try your script when i have some more time to figure them out.

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

Re: Reduce noise like Photoshop

Post by fmw42 »

see also IM -despeckle
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Reduce noise like Photoshop

Post by snibgo »

And -blur and -adaptive-blur. It depends on the nature of the noise, of course.
snibgo's IM pages: im.snibgo.com
slogra

Re: Reduce noise like Photoshop

Post by slogra »

W00t, turns out that "-enhance" does almost exactly what i was looking for in a noise filter. Too bad it doesn't have any tweak option though. I would like to tone down the filtering effect a tiny bit. Oh well, i'm very happy with the current result nevertheless.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Reduce noise like Photoshop

Post by fmw42 »

try -despeckle, it may be a tad better than -enhance
slogra

Re: Reduce noise like Photoshop

Post by slogra »

I tried despeckle but it does not give the result i'm looking for, it removes details that i want to keep. Enhance is close to PS, it blurs colors that are almost the same. However the effect is way to heavy.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Reduce noise like Photoshop

Post by snibgo »

You can lessen the effect of enhance (or other filter) by making it transparent and overlaying on the original. Vary the multplier between 0 (zero effect) to 1 (full effect).

Code: Select all

convert input.jpg ( +clone -enhance -alpha on -channel alpha -evaluate multiply 0.25 ) -composite output.jpg
snibgo's IM pages: im.snibgo.com
slogra

Re: Reduce noise like Photoshop

Post by slogra »

Yes, that might be a good idea. Another idea i had is to apply the filter before resizing.

Well, it's almost weekend so more time to mess around :).
Post Reply