We develop a nanosecond grating imaging (NGI) technique to measure inplane thermal transport properties in bulk and thin-film samples. Based on nanosecond time-domain thermoreflectance (ns-TDTR), NGI incorporates a photomask with periodic metal strips patterned on a transparent dielectric substrate to generate grating images of pump and probe lasers on the sample surface, which induces heat conduction along both cross-and inplane directions. Analytical and numerical models have been developed to extract thermal conductivities in both bulk and thin-film samples from NGI measurements. This newly developed technique is used to determine thickness-dependent in-plane thermal conductivities (κ x) in Cu nano-films, which agree well with the electron thermal conductivity values converted from four-point electrical conductivity measurements using the Wiedemamn-Franz law, as well as previously reported experimental values. The κ x measured with NGI in an 8 nm x 8 nm GaAs/AlAs superlattice (SL) is about 10.2 W/m⋅K, larger than the cross-plane thermal conductivity (8.8 W/m⋅K), indicating the anisotropic thermal transport in the SL structure. The uncertainty of the measured κ x is about 25% in the Cu film and less than 5% in SL. Sensitivity analysis suggests that, with the careful selection of proper substrate and interface resistance, the uncertainty of κ x in Cu nanofilms can be as low as 5%, showing the potential of the NGI technique to determine κ x in thin films with improved accuracy. By simply installing a photomask into ns-TDTR, NGI provides a convenient, fast, and cost-effective method to measure the in-plane thermal conductivities in a wide range of structures and materials.