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 337888 - Autocrop crops more than it should
Autocrop crops more than it should
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.2.x
Other All
: Normal normal
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-04-10 07:42 UTC by Nick Smith
Modified: 2008-01-15 13:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
XCF test case (25.18 KB, application/octet-stream)
2006-04-10 07:45 UTC, Nick Smith
Details
two more examples (12.40 KB, application/x-bzip)
2006-08-07 15:06 UTC, david gowers
Details

Description Nick Smith 2006-04-10 07:42:13 UTC
Please describe the problem:
When an entire row or column of pixels are all the same color with other colors
with fully transparent areas included, the area of full visibility at the edge
of the image are cropped away when using autocrop.

Steps to reproduce:
1.  Create a new image of any size (like 320x240).
2.  Create a new layer and have at least one row of all-white pixels (or any
color) on the top.
3.  Add a transparent row of pixels somewhere in the middle and pixels fully
transparent.
4.  Use layer > autocrop.

Actual results:
When using autocrop at the end, the row of white pixels disappears being cropped
out until the part that is partially transparent.  The area that is invisible
(fully transparent) also gets cropped away, of which I expect.

Expected results:
I only expect the fully transparent areas (alpha of 0) to be cropped away
leaving the white area alone, particularly with transparent layers.  If not a
transparent layer, the color to be cropped should be the background color from
the color swatches.

Does this happen every time?
As far as I can tell, yes.

Other information:
I created a test XCF file as a sample that has this.  Try using autocrop on the
five test layers and see what happens.  The four lower layers are cropped in a
strange way and the top layer (test 5) is how it should behave, even if there
were different colors colors around the border.
Comment 1 Nick Smith 2006-04-10 07:45:14 UTC
Created attachment 63079 [details]
XCF test case

Test the behavior of autocrop using the 5 test layers provided.  The lower 4 test layers have strange behaviors but the top layer, test 5, works like it should.
Comment 2 weskaggs 2006-05-21 20:11:31 UTC
I find this bug report very hard to understand, but I can see that something is indeed going wrong.  I'm not sure about the rest, but if you take the attached xcf image, and set it so that just the layers "Background" and "test 1" are visible, then do "autocrop layer" on the "test 1" layer, you will see that a small area along the bottom edge, and a small area along the right edge, get cropped when they should not be.
Comment 3 david gowers 2006-08-07 15:06:44 UTC
Created attachment 70395 [details]
two more examples

Try autocropping either of the upper two layers; both get their rightmost column chopped, both have varying intensities along that column.

Overzealousness only happens at the rightmost column for me -- if I duplicate the rightmost column at the next column to the left, still only the rightmost column is cropped. Repetetively autocropping it crops one duped column each time.

Hopefully this will help.
Comment 4 Michael Schumacher 2006-08-07 15:26:25 UTC
Hm... an off by one error?
Comment 5 Sven Neumann 2006-08-16 08:18:47 UTC
Now fixed in CVS (HEAD branch):

2006-08-16  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/autocrop.c (autocrop): fixed overzealousness
	when cropping on a drawable border (bug #337888).
Comment 6 Sven Neumann 2006-08-16 09:18:07 UTC
I've copied the autocrop() method from the HEAD branch to gimp-2-2:

2006-08-16  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/autocrop.c: merged changes from HEAD branch.
	Fixes bug #337888 and other problems.