Artifacts when scaling down with Sinc Lanczos3

Bug #648379 reported by Jason Gerard DeRose
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gimp (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: gimp

Scaling down a solid white field with the Sinc algorithm causes a weird thatched-pattern to appear. I've seen this before but now have an easy way to reproduce. I'm not sure whether the resolutions matter, but here's how I'm currently reproducing:

1. Create a new RGB image filled with solid white, size 5616x3744 (size of 5D Mark II images, what I was editing when I found it)
2. Scale down to 1200x800 using "Sinc (Lanczos3)" Interpolation
3. There will now be a weird thatched-pattern in the image, even though it should be completely #ffffff pixels

I attached the resulting image, saved as a PNG.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: gimp 2.6.10-1ubuntu3
ProcVersionSignature: Ubuntu 2.6.35-22.33-generic 2.6.35.4
Uname: Linux 2.6.35-22-generic x86_64
Architecture: amd64
CheckboxSubmission: fdbdfcded0c0bb479a6b52e9ec5af131
CheckboxSystem: edda5d4f616ca792bf437989cb597002
Date: Sun Sep 26 14:32:20 2010
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gimp

Revision history for this message
Jason Gerard DeRose (jderose) wrote :
Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Okay, definitely depends on resolutions, specifically the ratio of original to final size.

For example, I created a white-filled 1600x1600 RGB image and tried scaling to a few different sizes:

1/4: 1600x1600 => 400x400 Okay
1/5: 1600x1600 => 320x320 Artifacts
1/8: 1600x1600 => 200x200 Okay

In my original image I was scaling each side to approximately 1/4.7 the size. So it seems that it's at least around this ratio that the bug appears.

Revision history for this message
Harenome Ranaivoarivony Razanajato (kshegzyaj) wrote :

I can confirm that resizing at 1/5 of the original size can cause the appearance of some artifacts.

I have tried with the sizes you have been using, and with an original size of 1000x1000.
I have also tried with a 1200x1200 picture resized to 200x200, and the same problem occurs. Maybe the range is wider than you thought, as it also happens around a 1/6 ratio.

Also, it seem to occur only with white. I haven't been able to reproduce the bug if the image is filled with another color.

Revision history for this message
Izo (shakhtar9) wrote :

I can't reproduce this at all.

Revision history for this message
Harenome Ranaivoarivony Razanajato (kshegzyaj) wrote :

I forgot to say this: for my screen is not perfect, I couln't directly notice the "weird thatched-pattern".
In order to reveal the artifacts, I set the bucket-fill tool's threshold at 0 and then randomly clicked the area. If the scaling went fine, the whole image should be filled. When resizing at 1/5 and 1/6, only bits of the picture or the pattern itself would be filled.

So, in my case, I was not able to see the artifacts because of my screen's quality and settings, but these artifacts did exist.

Revision history for this message
Mark Harrison (mark-z-harrison) wrote :

Given the symptoms:

1) Occurs during resizing using factors that are not powers of 2 (i.e., 2, 4, 8, etc.). Comment #2
2) The thatched pattern is the color (254, 254, 254), where pure white is (255, 255, 255). Attachment to Comment #1
3) Only occurs for pure white (255, 255, 255) starting image. Comment #3

I would strongly suspect that this is not a bug, but a rounding error inherent in filter. It just happens that only images starting from pure white end up with rounding errors large enough to change a pixel value by one. The Lanczos filter actually takes on negative values at places, so that might be enough to put a resampled pixel one value below where it should be when the scaling isn't a nice power of 2.

In other words, this is a limitation of the filter, not a programming bug.

Revision history for this message
Thomas Hotz (thotz-deactivatedaccount) wrote :

With GIMP 2.8.4 it's not reproduce able for me. Please try to reproduce this with this GIMP version I used. Thank you very much!

Changed in gimp (Ubuntu):
status: New → Invalid
status: Invalid → Incomplete
Revision history for this message
Thomas Hotz (thotz-deactivatedaccount) wrote :

And for the next version (2.10) it is planned, that "Sinc (Lanczos3)" Interpolation will be replaced by a new one that works together with GEGL.

Look here please: http://www.gimpusers.com/tutorials/whats-new-in-gimp-2-10

I'm setting this bug due the link to confirmed.

Changed in gimp (Ubuntu):
status: Incomplete → Opinion
status: Opinion → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.