After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 317853 - Repeated 'Image Scale' causes heavy image defects
Repeated 'Image Scale' causes heavy image defects
Status: RESOLVED INVALID
Product: GIMP
Classification: Other
Component: General
2.3.x
Other All
: High normal
: Future
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-10-03 18:10 UTC by Martin Egger
Modified: 2008-01-15 14:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test script to demonstrate transform artefacts (2.56 KB, text/plain)
2005-10-05 17:41 UTC, Martin Egger
Details
Original test image (94.52 KB, image/jpeg)
2005-10-05 17:42 UTC, Martin Egger
Details
Artefacts at 200% with linear interpolation (56.15 KB, image/jpeg)
2005-10-05 17:43 UTC, Martin Egger
Details
Artefacts at 200% with none interpolation (85.01 KB, image/jpeg)
2005-10-05 17:44 UTC, Martin Egger
Details

Description Martin Egger 2005-10-03 18:10:56 UTC
Take a color image
do an image / image scale to about 110% with interpolation 'none'
repeat this operation 5 times

Using interpolation type 'lanczos' gives less visible defects, 'linear' shows
more, 'none' much more.

Using a script doing: (gimp-drawable-transform-scale TheLayer 0.0 0.0 NewWidth
NewHeight TRANSFORM-FORWARD INTERPOLATION-LANCZOS TRUE 3 FALSE) gives the same
results.

Sample image on: http://img67.imageshack.us/my.php?image=mg12664gu.jpg
Comment 1 weskaggs 2005-10-03 18:29:51 UTC
I have a fantasy that at some point GIMP will be able to recognize when the user
performs a sequence of linear transformations (move, scale, rotate, shear,
perspective), and use the Undo mechanism to compress them all into a single
transformation performed on the starting image.  But until that happens, the
sort of thing described here is inevitable.
Comment 2 Martin Egger 2005-10-03 18:36:11 UTC
I was implementing a 'stair interpolation' method in script-fu, so compressing
several scale transforms into one single operation is exactly what I don't want
to do.
Comment 3 Sven Neumann 2005-10-05 16:40:31 UTC
Regarding comment #1: Compressing transformations is the job of GEGL. It is not
related to Undo. What probably could be done with the current architecture is to
enable such compression in the transform tools.
Comment 4 Sven Neumann 2005-10-05 16:43:37 UTC
Back to the original bug report... Any transformation introduces artefacts. And
repeating the transformation will increase the artefacts. That isn't surprising.
If you think there's a problem, please make a simple test case (for example a
test image and a test script) that demonstrates the problem.
Comment 5 Martin Egger 2005-10-05 17:41:33 UTC
Created attachment 53067 [details]
Test script to demonstrate transform artefacts
Comment 6 Martin Egger 2005-10-05 17:42:47 UTC
Created attachment 53068 [details]
Original test image
Comment 7 Martin Egger 2005-10-05 17:43:43 UTC
Created attachment 53069 [details]
Artefacts at 200% with linear interpolation
Comment 8 Martin Egger 2005-10-05 17:44:12 UTC
Created attachment 53070 [details]
Artefacts at 200% with none interpolation
Comment 9 Martin Egger 2005-10-05 17:51:49 UTC
What I am worried about are not any 'normal' transformation artefacts but the
32*32 pixel grid that is introduced when repeating the interpolation. I think
this must be related to the methods used for transforming. Cubic an Lanczos
interpolation create the same artefacts, but they are a bit harder to see.

BTW - I am using Gimp 2.3.4 on Windows, but 2.2.8 on Linux gives the same results.
Comment 10 Michael Natterer 2005-10-05 18:29:15 UTC
Ok, it's apparently accumulating the error, that needs to be fixed.
Comment 11 Andrew W Boniface 2006-02-24 02:52:34 UTC
I agree with the comments on "normal" artifacts from scaling or other transforms.  The example given seems to be something else.  I expect the artifacts from interpolation="none" should look like the distortion that you used to see on Macintoshes when you tried using a font set to a size without a bitmap defined for that size, i.e. a one pixel line would become a two pixel line in some locations, but remain a one pixel line in others.  Repeated integer factor scalings with interpolation="none" should not accumulate artifacts if the fixed point of the scaling is always the same.  If I scale up a pixel by a linear factor of 5 it should become a 5x5 block of pixels.  If I then scale that down by a factor of 5 I should get the original image (if since the fixed point is invariant, the 5x5 grid of 'big pixels' does not change).  If the fixed point varies from transform to transform, I can see how additional artifacts might arise (I presume that the color of the scaled down pixel is an average of the 5x5 block that corresponds to it.

If my understanding of interpolation="none" is faulty, please explain.
Comment 12 weskaggs 2006-05-21 19:10:33 UTC
bumping to Future because this will not be solved for 2.4, although it remains quite an important goal.
Comment 13 Sven Neumann 2007-05-08 09:50:45 UTC
This seems still to be a problem in current SVN. The test script as attached unfortunately uses INTERPOLATION_NONE and it isn't very surprising that there are artefacts with interpolation turned off. But the artefacts are also clearly visible with interpolation.
Comment 14 gg 2007-05-08 12:50:55 UTC
It's perhaps worth noting that NONE is not none, it's nearest neighbour, which although crude should be statistically symetrical if implemented correctly. 

I dont see why it should create any more drift than other methods if use to apply a rotation about the centre of an image.

In the case of such a rotation the artifacts should be symetrical.

In the code that I have worked on NONE seems to get special treatment early on and so the code path is typically rather different from the other methods that tend to remain common longer.

Comment 15 Martin Egger 2007-05-08 16:36:32 UTC
Is there any chance to get this one fixed before 2.4? OK, I know, it's not planned (comment #12), but the bug is rather annoying.
Comment 16 Sven Neumann 2007-05-08 17:10:38 UTC
We are certainly not going to block the release for this. And since there's enough to do keep everyone busy, it would probably be best if you looked at it yourself.
Comment 17 Sven Neumann 2007-05-08 17:17:27 UTC
In response to comment #14: Nearest-neighbor is not what I would call an interpolation method. Of course it shouldn't introduce the artifacts we are seeing here, but it is difficult to predict what artifacts might stem from doing repeated scaling operations.

gg, this report is not about rotation and we aren't talking about a drift here. So your comments seems pretty much out of place. If you think that some code handles NONE incorrectly, please open a bug report and point out a particular place instead of adding such irritating comments here. Thanks.
Comment 18 Sven Neumann 2008-01-15 13:18:53 UTC
I had a look at this again. The original image attached to this bug report already has artifacts from JPEG compression. This whole bug report is outdated and bogus. Closing as INVALID.