The thermodynamic stability and simulated STM images of graphene nanoribbons