Jabeur Mejri was freed in March after serving two years of a seven-and-a-half-year term for the caricatures but was jailed again in April for eight months for insulting a court clerk during an argument about the date of a summons.
"As part of a presidential pardon, Jabeur Mejri was freed overnight Tuesday to Wednesday," lawyer Bassem Trifi told AFP.
The 29-year-old was freed in March after receiving a first presidential pardon.
Mejri, an atheist activist, was an unemployed graduate at the time of his imprisonment in 2012, but had worked at the railroad ticket office in his hometown of Mahdia, south of Tunis.
His first conviction came shortly after the rise to power of the moderate Islamist party Ennahda, which triumphed in Tunisia's first free elections after the 2011 revolution.
Amnesty International called Mejri the first prisoner of conscience in Tunisia following the 2011 uprising that ousted longtime president Zine El Abidine Ben Ali.