In this work, we present a code that transforms 2D transmission electron microscopy images into 3D geometries for discrete dipole approximation simulations in DDSCAT 7.3.3 based on Python 3.11 and OpenCV 4.8.1. This allows for the extrapolation of experimental sample images into ready-to-use simulation geometries. The advantage is that the geometry reflects complex shapes instead of approximations of basic shapes like spheres, cylinders, or cubes. The underlying algorithm to extrapolate 2D images to 3D structures is inspired by the working principle of kernels used in image processing. To showcase the code, the absorption spectrum of deposited gold nanoparticles was simulated and compared with experimental values. Apart from a small systematic shift of the simulated spectrum, it is in excellent agreement with the experiment.