Scanning transmission electron microscopy (STEM) is a suitable method for the quantitative characterization of nanomaterials. For an absolute composition determination on an atomic scale, the thickness of the specimen has to be known locally with high accuracy. Here, we propose a method to determine both thickness and composition of ternary III-V semiconductors locally from one STEM image as shown for the example material systems Ga(AsBi) and (GaIn)As. In a simulation study, the feasibility of the method is proven and the influence of specimen thickness and detector angles used is investigated. An application to an experimental STEM image of a Ga(AsBi) quantum well grown by metal organic vapour phase epitaxy yields an excellent agreement with composition results from high resolution X-ray diffraction.