generalise mesh and image API