smoothing..

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
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

smoothing..

Post by dognose »

Hi,
I'm using another program that is generating images, however, they have a lot of pixelated noise.

Here is an example: https://cloud.githubusercontent.com/ass ... 9e7c1e.png

Any advice on removing this pattern, or smoothing the image. The only smoothing tool I've seen makes the image too blurry.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: smoothing..

Post by snibgo »

Well, the image is made of "giant pixels", that are each 8x8 pixels. And even then, the giant pixels are in a patchwork of 2x2.

So "-scale 12.5%" doesn't lose any data. "-resize 12.5%" somewhat merges the 2x2 pattern of giant pixels, so looks better.

Then, if you want, you can "-resize 800%", and then perhaps sharpen the result. Or you might apply more complex processing to identify areas of flat or gradient colour, and edge detail. See my pages "Cartoon and texture", "Flat-colour cartoons", etc.
snibgo's IM pages: im.snibgo.com
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Re: smoothing..

Post by dognose »

I see what you mean.. The 8x8 was just the enlargement of the detail, post processing.... but it's the 2x2 patchwork that is the real problem

I'm guessing that it's rendered at half the size then enlarged without the regard for contour.

50% then 200% resize does help somewhat.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: smoothing..

Post by snibgo »

So the 8x8 giant pixels are not relevant, but you want to remove the 2x2 patchwork? Okay. The following is Windows BAT script.

First, reduce to 1/8 size:

Code: Select all

%IM%convert screenDots.png -resize 12.5%% sd_small.png
Image

From my "Cartoon and texture" page, we use cartTextEep.bat to smooth the areas into gradients.

Code: Select all

call %PICTBAT%cartTextEep sd_small.png sd_small_XX.png 0.5
Image

The script has created a mask of the edges, so we use that to paint back the original edges.

Code: Select all

%IM%convert ^
  sd_small_cart.png ^
  sd_small.png ^
  sd_small_edges.png ^
  -composite ^
  sd_small_out.png
Image
The result has the original edge detail, but with the noise smoothed away.

(The differences between the images are clearly seen when they are enlarged.)
snibgo's IM pages: im.snibgo.com
Post Reply