The pattern transition induced by lattice anisotropy (LA) and magnetic impurities is computationally observed in near-optimally doped d-wave superconductors (DSCs). For the single impurity case, a transition from the checkerboard to stripe pattern can be induced by a very weak LA. For the two-impurity case, an orientation transition from the longitudinal stripe into transverse pattern is observed when the LA ratio reaches some critical value. At the critical point, the structures around impurities can restore checkerboard patterns. These results indicate that the formation of stripes in DSCs might induced by various effects, and could be tunable experimentally.