Quantitative analysis of pores for die casting magnesium alloy was put forward in this paper based on Matlab software, the parameters of pores include the average diameter, distributing uniformity and area percent of pores. The parameters of pores and density of some samples were measured. The results showed that the density of sample was inverse ratio to the area percent of pores, it validated the feasibility of our ideas indirectly.