The presented work describes the capabilities of a state-of-the-art spectroscopic photon-counting hybrid pixel detector for use in non-destructive testing, as a contaminant detector with potential uses in the food and pharmaceutical industries. A pharmaceutical hard capsule containing vitamin powder, contaminated with Steel (ST) and Tungsten (W) was prepared under controlled conditions. Both contaminants are distinguished from the powder by combining sub-pixel imaging with spectroscopic imaging analysis, made possible by the use of a 2 mm CdZnTe sensor coupled to a Timepix3 ASIC, operated in Time-over-Threshold and Time-of-Arrival mode. The sub-pixelization technique achieves a spatial resolution of 18.3 μm, with a maximum photon flux of 2.5× 106 photons/s· cm2. For the spectral analysis technique implemented, each energy bin image is energy-weighted, with weights optimally defined by considering the bin contrast and noise behavior, and combined to form an integrated-spectrum enhanced image with increased contaminant visibility. Contrast-to-Noise Ratio (CNR) for each contaminant type was used for performance assessment of the approach. A CNR increase of 106% above the reference unweighted-spectrum image was achieved for the ST contaminant, while the denser W contaminant showed a CNR increase of 80%. This means that the presented spectroscopic imaging technique is feasible for implementation in material visibility enhancement.