The failure of the Scanning Line Corrector of ETM+2004 of Landsat7 in imposed systematic data gap lines on retrieved the correct satellite images and rejected the ability to provide continuous information in different scientific fields. While a many processing algorithms proposed to fill out this gap lines, utmost of these algorithms are just only valid through the homogeneous image regions. When there are applied to process the heterogeneous ETM+landsat7 images, returning image pixels and image features can’t become correct and precise. In this study a gap filling algorithm has been proposed that is based on the morphologic operations of image. The operations used here are combination of the processes, dilation and erosion. The algorithm employs opening, closing morphologic operations of gap image methods to identify the properties and size the separated gab lines image for ETM+landsat7 images. Each band images has been passed through milt-image processing stages. The images that output of all stages are eight corrected images. Enhanced images are very clear and the gab lines completely disappear from all image bands. The algorithm succeeded in correction and filling gab lines for homogeneous and heterogeneous image areas.