Post Reply 

[Solved] Gimp vs moire

May 27, 2014, 13:24 (This post was last modified: May 28, 2014 09:59 by Walen.)
Post: #1
[Solved] Gimp vs moire
I started using gimp some time ago as a replacement for MS Paint. For the most part basic operations like resizing produce superior outputs once you get used to the ui. Yet I just happened to stumble upon a strange example.

I have a badly scanned image that I want to resize down ~2x. When using gimp there is a massive, eyesoring moire effect in one part of the image. I have glanced at the first few google links on the subject that suggest fourier plugin and dug up a post here on the forums that recommends gauss blur filter. I have already tried the second solution and the effect is much better than the default. Still both MS Paint and my internet browser have no problems with the same file and display absolutely perfect, razor sharp image at half the size and don't require any intricate knowledge.

I do understand resizing bitmaps is a subtle process, but come on, is there no way to replicate the result in gimp at all?
Find all posts by this user
Quote this message in a reply
May 27, 2014, 16:14
Post: #2
RE: Gimp vs moire
I've been testing a script "scale in steps" that scales down (only) to a specified size & retains quality quite well.

When you install it, a "script-fu" menu should show at the top of the menus. Go to it, then its under there called "Scale in steps"

Note: Do a test to scale down with the Scale scale tool, to get the dimension/proportions right before you scale down with the script. There is no live preview, but it works well for down-scaling ^_^

"In order to succeed, your desire for success should be greater than fear of failure." BC
[Image: 29uocaf.png]
iFS007 tut vids on YT ~ auto color B&W landscape tut
Visit this user's website Find all posts by this user
Quote this message in a reply
May 27, 2014, 16:18 (This post was last modified: May 28, 2014 09:58 by Walen.)
Post: #3
RE: Gimp vs moire
(May 27, 2014 14:11)ofnuts Wrote:  The blur is needed, explicit or not.
Is it? Look below.
(May 27, 2014 14:11)ofnuts Wrote:  The various interpolation algorithms have different "frequency responses" so may produce moire effects on different images. Gimp as 4 algorithms you can choose from (but as said above getting good results with one on one image doesn't mean it will always produce good results on other images).
Indeed I found Cubic to work best for me. And have a history of 100+ images resized. This is a first (second followed just after that) one that causes problems - I guess just my luck to meet a specific pattern with a specific scaling.
(May 27, 2014 14:11)ofnuts Wrote:  Can you post your image (or a suitable extract) at original size?
[Image: Moireresizing_zps346ef7a8.jpg~original]
From left: original pic at 1388px height, ms paint resize at 700px and gimp resize with gauss blur 2px.

Notice that raster is still visible in the middle picture - a carbon copy of the original. Right picture has acceptable quality in the graphical part. But the text part is visibly blurred and slightly discolored.
Find all posts by this user
Quote this message in a reply
May 27, 2014, 17:36
Post: #4
RE: Gimp vs moire
(May 27, 2014 16:18)Walen Wrote:  ..snip..
Notice that raster is still visible in the middle picture - a carbon copy of the original. Right picture has acceptable quality in the graphical part. But the text part is visibly blurred and slightly discolored

Still not quite sure what the requirements are.

Is it. You like the sharpness of the 'paint' rescale but you want to get rid of the noise, without the softness that Gimp introduces?

You can get rid of some of the noise using a FFT (fast-fourier-transform) but too much and there is a lot of 'softness' Still worth a try on the full size image. I would recommend G'mic as an easy way to get FFT but I think it might be broken on the latest version.

   

Scaling these small images as you said better with the Cubic option. AFAIK it is supposed to give a slightly sharper image. Sharpen a bit more? Too much and you get the noise back. A very small unsharp mask application perhaps.

   

** https://www.gimp-forum.net/ now answering questions**
Find all posts by this user
Quote this message in a reply
May 27, 2014, 21:11
Post: #5
RE: Gimp vs moire
(May 27, 2014 17:36)rich2005 Wrote:  Still not quite sure what the requirements are.
Ok I might not have been perfectly clear on what I want. So let me rephrase the problem (for the important part skip the next paragraph).

I am a basic user that has an ongoing side-project that involves a small degree of bitmap editing - you know, crop here and there, resize and choose compression level type. Two clicks at most, rinse and repeat, and concentrate on the important parts. Usually a simplistic program (aka MS Paint) gets the job done but more and more often I found myself wanting to perform those simple operations slightly different than the 95% users the simplistic program was optimised for. Hence my interest in gimp. The problem here is that the user interface and usage philosophy is absolutely atrocious for a casual user (not that the big commercial programs are any better in this respect). But if one wants more control there is not really any other option than being overwhelmed initially, right?

So what I want?
1. Quick, efficient and comfortable way to process images to resolution and memory consumption of my liking.
2. While willing to learn I certainly don't want to spend years getting a Ph.D. in computer graphics.
3. Output file must look more or less ok - don't need to study each individual pixel under a magnifying glass, life is too short for that. At the same time I will be personally looking at the pictures in the future so avoiding tearing my eyes out would be nice.

In regards to the picture in question. English is not my first language so mayby I wasn't able to convey what I wanted. To illustrate what I meant by moire: second top left image. The raster (or whatever it is called in english) starts interfering when using a naive algorithm after reaching certain resize treshold producing really ugly results. In THIS instance Paint did the job covering all three requirements, surprisingly I might add as I was starting to get used to gimp. But what if I will need to do the same later and the take-it-or-leave-it approach fails misearbly? I might as well save myself some frustration by solving the issue now. Be reminded that the original reason I got into gimp was that I need more control.

In this particular case scale image option in gimp results in a textbook example of the above interference (disqualifying result). Slight blurring is actually not a bad thing when you are dealing with a graphical element, even more so a photograph. But this image contains both graphical and text elements. The posted excerpt may not show it well but the small fonts are really visibly blurred compared to the original/paint resize (thus negating req.3) even though the graphical part looks slightly better than paint resize and noticably better than original.

I assume the first image you posted is a result of applying the FFT method to the original image in orig resolution. While I think I grasp the principle it hardly strikes me as a beginner level operation (negating req.2). Additionally removing noise in itself is not my goal at all and resulting quality is comparable with the blurred aproach above (not counting the "mathy" halos). I will try to toy with FFT when I have too much time though.

I assume the second image is the first image scaled down + unsharp filter. A few seconds toying with sharpening and bingo! Applying that to the third pic of my own actually produces a superior quality compared to both original/paint resize due to juicer colors as a side effect (ok if you take a magnifying glass and compare pixel by pixel there are slight distortions at places but the overall impression - my point really - is much better). So mission accomplished, sort of.

To sum it up:
Paint: quick, faithful result (in this instance)
Gimp: three separate operations (blur, scale down, sharpen), superior result.
[Image: Moireresizingsolved_zps1bc8c0c9.jpg~original]

@iForStyle007 The only thing I understood from your post was to toy with resize tool. Which makes me wonder. The funny thing I discovered is that while interference kicks in under 55% image size, the 1:2 zoom looks exactly like paint/internet browser resize, i.e. perfect. Any particular reason for this duality inside gimp? Different algorithms for viewing and actual physical image? If so why are the important ones worse?
Find all posts by this user
Quote this message in a reply
May 28, 2014, 00:32
Post: #6
RE: Gimp vs moire
Apologies, Try the script I mentioned earlier. Download & put the .SCM file in your gimp script folder.
Scale in steps
http://registry.gimp.org/node/9676

Then restart Gimp, and in the part where it says "File Edit Image ...." look for a new "Script-Fu" menu "Scale in steps" will be there.

This maybe one step for down-scaling in your case, post your results when you get a chance Smile
Visit this user's website Find all posts by this user
Quote this message in a reply
May 28, 2014, 09:57 (This post was last modified: May 28, 2014 10:02 by Walen.)
Post: #7
RE: Gimp vs moire
Ok, I managed to get it working after minor problems. And NOW I understand your earlier postWink As for results no need to post them. The output of your script is comparable with blur+resize but if you look really closely it is a little bit sharper (not like in your example, it is a scan, not a photo and a smaller res to start with), yet still considerably worse than ms paint. Anyway most pictures work with just standard resize alone. Some pics from the obsolete world of printing/scanning just seem to require a form of blurring. But once I tried how sharpening tastes like I am unlikely not to put it into more use.

I guess your script comes ideally for a lazy day for quicky acceptable conversions.

Thanks to both of you the problem is solved.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  GIMP on older pc elyman 1 49 Dec 10, 2018 17:17
Last Post: paynekj
  Blurry GIMP interface on macOS High Sierra 10.13.6 vagkavo 1 238 Aug 26, 2018 07:52
Last Post: paynekj
  [SOLVED]gimpenums not loaded indigo3k 2 164 Aug 20, 2018 20:09
Last Post: paynekj
  Gimp wont keep merging when exporting Ergu 1 270 Aug 8, 2018 21:22
Last Post: paynekj
  Printers not showing in gimp chrismacor 1 286 May 24, 2018 06:03
Last Post: paynekj

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS