Microporosity in cast aluminum alloys formed during solidification of castings can be due to the evolution of dissolved hydrogen gas from the liquid metal, the inability of liquid metal to feed through interdendritic channels, or a combination of both. The secondary dendrite arm spacing (SDAS) of the casting may affect either the evolution of hydrogen gas or the ability of feeding. In this investigation, a method based on the Nearest-Neighbor-Distance (NND for short) cluster analysis of image analysis data was used for distinguishing the gas and shrinkage pores in A357 alloy, in order to study the effects of SDAS on the microporosity formation. It shows that the shrinkage pores are prone to form in the specimens with small SDAS. The discrete, isolated gas microporosity is prone to form in the specimens with large SDAS.