private void PerformAutoCrop(BitMatrix matrix) { int left, right, top, bottom; GetLastEmptyLeftRow(matrix, out left); GetLastEmptyRightRow(matrix, out right); GetLastEmptyTopRow(matrix, out top); GetLastEmptyBottomRow(matrix, out bottom); matrix.Crop( left, top, matrix.Width - left - (matrix.Width - right), matrix.Height - top - (matrix.Height - bottom) ); }