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 120490 - Scale tool produces wrong output (misses parts of image)
Scale tool produces wrong output (misses parts of image)
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
1.x
Other Linux
: Normal normal
: 2.0
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2003-08-22 16:29 UTC by Eugene Butan
Modified: 2004-04-10 11:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for app/core/gimpdrawable-transform.c (2.12 KB, patch)
2004-04-05 23:42 UTC, weskaggs
none Details | Review

Description Eugene Butan 2003-08-22 16:29:58 UTC
Scaling a layer when you need to scroll the window in order to get the size
needed forces GIMP to display only part of a scaled image after transformation.
Comment 1 Michael Natterer 2003-08-22 17:23:44 UTC
Sorry, I don't understand anything in this bugreport.
Setting to NEEDINFO until the reported rephrases.
Comment 2 Eugene Butan 2003-08-22 19:06:48 UTC
Suppose you have an image say 30x1000. Naturally, you zoom it, and it
doesn't fit in a window. You select part of and try to scale across
all 1000 points or centimetres or whatever. 
As mentioned before, you need to scroll the window to view all the
image. So here is what I have done:

1) I moved the marker (square one - indicates an angle of selection
during scaling)
2) Then I scrolled the window a bit.
3) I had to repeat these two steps 2 or three times until the marker
have reached the desired position.
4)Then I pressed the 'Scale' button.

So the image has scaled, but there were some gaps left in the scaled
part, not filled with the color.

I test it about 5-10 times on various image sizes.
Comment 3 Sven Neumann 2003-08-23 10:14:57 UTC
You used the Scale tool with Interpolation set to None. The empty gaps
you got are caused by this setting. Use Linear or Cubic to get rid of
them.
Comment 4 Eugene Butan 2003-08-28 07:59:21 UTC
I tried it with various types of interpolation. By the way,
Interpolation  set to None works fine when you do not have to scroll
the window.
Comment 5 Sven Neumann 2003-08-28 10:46:22 UTC
Guess we need to reopen the report then and the reporter will have to
try to come up with a better explanation of what he thinks is going
wrong here.
Comment 6 Michael Natterer 2004-01-18 23:08:01 UTC
The fact that scrolling is involved suggests this could be
a duplicate of bug #116765.

Eugene, would you check if the bug is still there in
2.0pre2 (as soon as it is out, probably tomorrow).
Comment 7 Sven Neumann 2004-02-09 01:06:23 UTC
We are waiting for feedback from the bug reporter here.
Comment 8 Eugene Butan 2004-02-09 15:02:08 UTC
Still getting almost the same error:( The main difference is that now
it misses only the beginning of the selection.
Here goes step-by-step procedure:
1) Create empty image with alpha channel, say 1000x10px
2) Zoom until you need to scroll 5 or 6 screens in order to view the
entire image.
3) select a rectangle from the beginning (left side) of the image and
fill it with gradient. Like this:

[xx                              ], where xx - the filled part.

4) now select scale tool, set it to bicubic and try to scale the
selected area (filled with gradient) to the entire image. I.e. try to
achieve this:

[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]

Naturally, you have to scroll the screen to move the scale mark to the
right side of the image.

5) Instead of expected image, you'll get something like:

[     xxxxxxxxxxxxxxxxxxxxxxxxxxx]

Note the missing part in the beginning of the image.
Comment 9 Sven Neumann 2004-02-09 15:16:29 UTC
I can reproduce this behaviour with current CVS. And you don't need to
zoom in or out to reproduce it
Comment 10 Sven Neumann 2004-02-09 15:19:45 UTC
We can bump this to 2.0.1 if we don't manage to fix before 2.0.
Comment 11 Dave Neary 2004-03-10 10:48:49 UTC
Bumping a bunch of bugs which won't block the 2.0 release to 2.0.1.

Dave.
Comment 12 Simon Budig 2004-03-16 20:03:49 UTC
There apparently is a wrong 0.5 px offset lurking somewhere.

Scaling a 50 pixel wide image to a width of 1000 px results in a 9-10
pixel displacement (= 0.5 * scale factor 20) at the left, s, and the
right edge fades (also for about 10 pixels) into transparent, as if
there would be taken half of a transparent source-pixel into account.

Interpolation-type = None does not show this behaviour.
Comment 13 Simon Budig 2004-03-16 20:30:47 UTC
Comparing a scaled layer (layer->scale layer) with the results from
the scale tool shows, that the "inner" image content is scaled
correctly (no 0.5 offset), it is just the border handling that is wrong.
Comment 14 weskaggs 2004-04-05 23:42:45 UTC
Created attachment 26382 [details] [review]
patch for app/core/gimpdrawable-transform.c

Attached is a patch that seems to solve this problem.  The code is
exceptionally complex, though, and is used for all of the transform tools, so
my confidence is not high that it does not cause something else to break.
Comment 15 Sven Neumann 2004-04-06 00:25:09 UTC
The addition of 0.5 was not present in the original code that was introduced
with revision 1.61 as part of a patch to fix bug #109817. It was added with
revision 1.63 as part of a commit from Pedro with the following comment:

        * app/core/gimpdrawable-transform.c
        (gimp_drawable_transform_tiles_affine): Fix copy'n'paste slip in
        coordinates calculation for supersampling code. Transform the
        pixel centers properly. Fixes bug #10466.

Applying the attached patch bears the risk to reopen this bug.
Comment 16 Pedro Gimeno 2004-04-06 22:40:18 UTC
After some testing I could not reproduce bug #10466 either with or without the
patch, so it seems like an enhancement. Probably my introduction of the -0.5
offset in the surrounding pixels was bogus. As Bill says, the code is quite
complex, and I'm not confident about its correctness either patched or
unpatched. My intention was to shift the source coordinates to the pixel centers
but I observed the introduction of a bias which I tried to correct.

After applying the patch the transform behaves as expected under several testing
conditions. I made rotation/scaling/shearing tests with this image:
http://bugzilla.gnome.org/attachment.cgi?id=25422&action=view and an odd-sized
version, plus the testcase described in comment #8.
Comment 17 Sven Neumann 2004-04-07 00:10:02 UTC
I'd say we commit it then.
Comment 18 Pedro Gimeno 2004-04-10 11:37:04 UTC
I've applied Bill's patch; closing this bug now. Please reopen if something is
still wrong; I may have missed something.

2004-04-10  Pedro Gimeno

	* app/core/gimpdrawable-transform.c
	(gimp_drawable_transform_tiles_affine): Applied patch from William
	Skaggs that addresses bug #120490.

	* app/sanity.c (sanity_check): Modified the message that reports
	an old version of Fontconfig in an attempt to make it more
	informative.