We propose a custom analysis technique for the dark field (DF) image based on transmission electron microscopy (TEM). The custom analysis technique is developed based on the DigitalMicrograph® (DM) script language embedded in the Gatan digital microscopy software, which is used as the operational software for most TEM instruments. The developed software automatically scans an electron beam across a TEM sample and records a series of electron diffraction patterns. The recorded electron diffraction patterns provide DF and ADF images based on digital image processing. An experimental electron diffraction pattern is recorded from a IrMn polycrystal consisting of fine nanograins in order to test the proposed software. We demonstrate that the developed image processing technique well resolves nanograins of ~ 5 nm in diameter.