  Let X be a complex algebraic K3 surface or a supersingular K3 surface in odd
characteristic. We present an algorithm by which, under certain assumptions on
X, we can calculate a finite set of generators of the image of the natural
homomorphism from the automorphism group of X to the orthogonal group of the
N\'eron-Severi lattice of X. We then apply this algorithm to certain complex K3
surfaces, among which are singular K3 surfaces whose transcendental lattices
are of small discriminants.
