DigiSim - An Open Source Software Package for Heterogeneous Material Modeling Based on Digital Image Processing. An open source software package to generate numerical model for finite element method (FEM) and discrete element method (DEM) based on digital image is proposed. Both 2D bitmap and 3D volumetric images are supported. This package includes geometrical and analytical routines for vectorizing bitmap image, computing geometric information statistics, and generating numerical models. The ability of handling complex connected region enables the modeling of heterogeneous materials with complex microstructure. Four examples have indicated that the code is robust, efficient, and user-friendly. As an open source and ready-to-use Matlab package, it has broad application prospect in mechanical behavior analysis for heterogeneous materials.