Accurate sensor placement is vital for non-invasive brain imaging, particularly for functional near-infrared spectroscopy (fNIRS) and diffuse optical tomography (DOT), which lack standardized layouts such as those in electroencephalography (EEG). Custom, manually prepared probe layouts on textile caps are often imprecise and labor intensive. We introduce a method for creating personalized, 3D-printed headgear, enabling the accurate translation of 3D brain coordinates to 2D printable panels for custom fNIRS and EEG sensor layouts while reducing costs and manual labor. Our approach uses atlas-based or subject-specific head models and a spring-relaxation algorithm for flattening 3D coordinates onto 2D panels, using 10-5 EEG coordinates for reference. This process ensures geometrical fidelity, crucial for accurate probe placement. Probe geometries and holder types are customizable and printed directly on the cap, making the approach agnostic to instrument manufacturers and probe types. Our ninjaCap method offers 2.7±1.8mm probe placement accuracy. Over the last five years, we have developed and validated this approach with over 50 cap models and 500 participants. A cloud-based ninjaCap generation pipeline along with detailed instructions is now available at openfnirs.org. The ninjaCap marks a significant advancement in creating individualized neuroimaging caps, reducing costs and labor while improving probe placement accuracy, thereby reducing variability in research.