GNOME Bugzilla – Bug 321511
rotation tool does not smooth the edges
Last modified: 2008-01-15 13:02:27 UTC
Please describe the problem: If the layer has the same size than the image, after rotation the layer's edges are not smoothed. It is necessary to increase layer's dimensions before rotation so that layer's edges are smoothed. Steps to reproduce: 1. Create new document 2. Add new layer 3. Fill with the color of your choice 4. Tools > Rotation > -8° (for example) 4bis. Layer > Layer Boundary Size > width:+10px height:+10px Center 5bis. Tools > Rotation > -8° (for example) Actual results: In 4. the layer's edges are not smoothed. In 5bis. the layer's edges are smoothed. Expected results: Step 4. should be like step 5bis. Does this happen every time? Yes. Other information: An example : http://pioupioum.free.fr/bugs/rotation_bug_smooth.png
This also happens when a rectangular selection is transformed, and applies not only to rotation but to perspective and shear transformations.
Created attachment 58821 [details] An example
Since the size of the canvas after rotation is always larger than the original one and has some room for the extra pixels coming from the antialasing, it would definitely make sense to ensure that these pixels are put to good use. Before rotation, we could add a border around the existing layer. Maybe 1 to 3 pixels, depending on the scaling algorithm used. An additional improvement would be to enlarge the layer only if necessary: before scaling, check the pixels on the 4 edges and do not enlarge the layer along the edges that are already fully transparent. This would ensure that the layer does not grow all the time if multiple transformations are applied to it (multiple transformations are usually a bad idea because of the loss of precision, but they may be necessary in some cases).
.. This is caused by the fix to a bug in the perspective transformation, where the edges of the area being transformed would not map exactly to the edges of the shape described by the perspective transform. There, a border of pixels with alpha =0 was presumed (and thus 'shrunk' the area by percolating transparency into it. sometimes in massive amounts) I know no way to resolve this that would not break the fix for the mentioned bug ( bug #144352 ), and vice versa. It might have to end up as a togglable option.
This appears to be fixed in recent versions of GIMP 2.3. Probably was fixed when I cleaned up the PixelSurround code.