Using the canonical JSJ splitting, we describe the outer automorphism group $\Out(G)$ of a one-ended word hyperbolic group $G$. In particular, we discuss to what extent $\Out(G)$ is virtually a direct product of mapping class groups and a free abelian group, and we determine for which groups $\Out(G)$ is infinite. We also show that there are only finitely many conjugacy classes of torsion elements in $\Out(G)$, for $G$ any torsion-free hyperbolic group. More generally, let $\Gamma $ be a finite graph of groups decomposition of an arbitrary group $G$ such that edge groups $G_e$ are rigid (i.e\. $\Out(G_e)$ is finite). We describe the group of automorphisms of $G$ preserving $\Gamma $, by comparing it to direct products of suitably defined mapping class groups of vertex groups.