  We study contact representations for graphs, which we call pixel
representations in 2D and voxel representations in 3D. Our representations are
based on the unit square grid whose cells we call pixels in 2D and voxels in
3D. Two pixels are adjacent if they share an edge, two voxels if they share a
face. We call a connected set of pixels or voxels a blob. Given a graph, we
represent its vertices by disjoint blobs such that two blobs contain adjacent
pixels or voxels if and only if the corresponding vertices are adjacent. We are
interested in the size of a representation, which is the number of pixels or
voxels it consists of.
  We first show that finding minimum-size representations is NP-complete. Then,
we bound representation sizes needed for certain graph classes. In 2D, we show
that, for $k$-outerplanar graphs with $n$ vertices, $\Theta(kn)$ pixels are
always sufficient and sometimes necessary. In particular, outerplanar graphs
can be represented with a linear number of pixels, whereas general planar
graphs sometimes need a quadratic number. In 3D, $\Theta(n^2)$ voxels are
always sufficient and sometimes necessary for any $n$-vertex graph. We improve
this bound to $\Theta(n\cdot \tau)$ for graphs of treewidth $\tau$ and to
$O((g+1)^2n\log^2n)$ for graphs of genus $g$. In particular, planar graphs
admit representations with $O(n\log^2n)$ voxels.
