Autocrop was cropping too much, eliminating the first non-background

row/column on each edge.
This commit is contained in:
Akkana Peck 2005-09-29 23:15:41 +00:00
parent 622c3d04f8
commit aa24ce9c40
1 changed files with 12 additions and 0 deletions

View File

@ -237,6 +237,12 @@ autocrop (GimpDrawable *drawable,
y2 += 1; /* to make y2 - y1 == height */ y2 += 1; /* to make y2 - y1 == height */
/* The coordinates are now the first rows which DON'T match
* the color. Crop instead to one row larger:
*/
if (y1 > 0) --y1;
if (y2 < height-1) ++y2;
if (show_progress) if (show_progress)
gimp_progress_update (0.5); gimp_progress_update (0.5);
@ -263,6 +269,12 @@ autocrop (GimpDrawable *drawable,
x2 += 1; /* to make x2 - x1 == width */ x2 += 1; /* to make x2 - x1 == width */
/* The coordinates are now the first columns which DON'T match
* the color. Crop instead to one column larger:
*/
if (x1 > 0) --x1;
if (x2 < width-1) ++x2;
g_free (buffer); g_free (buffer);
gimp_drawable_detach (drawable); gimp_drawable_detach (drawable);