Physical porosity in rocks, like shale and carbonate, has a large effect on the their storage capacity. The pore geometries also affect their permeability. Imaging the visible pore space provides insights into the physical pore space, pore geometries, and the associated mineral and organic matter phases relevant for storage and transport. For example, organic-matter porosity is an important property of mature organic-rich shales providing storage capacity for liquids and gases, like hydrocarbons. Imaging the microstructure is the only technique which delivers data giving direct insight into the organic matter porosity. However, imaging porosity in fine-grained shale as well as carbonate rocks in a representative way at high resolution is challenging. The challenge is mainly due to sample heterogeneity and small pore sizes (< 5 μm) in shales and large pore size variation in carbonates. Exploiting the technologies Virtual Petrography (ViP), broad ion beam (BIB) milling, and scanning electron microscopy (SEM), the porosity in shales and carbonates can be assessed with nanoscale resolution in a representative way.