kpartx reads the partition table of a device or image and creates device-mapper devices for each partition. It is called automatically for multipath devices and is the classic way to mount partitions inside a raw disk image.
sudo kpartx -l disk.img # list partitions that would be mapped
sudo kpartx -av disk.img # add mappings; prints e.g. /dev/mapper/loop0p1
sudo mount /dev/mapper/loop0p1 /mnt/img
# ... work ...
sudo umount /mnt/img
sudo kpartx -dv disk.img # remove mappings (also: sudo losetup -d /dev/loop0)
Modern alternative without kpartx: sudo losetup --find --show --partscan disk.img, which creates /dev/loopNp1 directly. It is derived from util-linux's partx.