Added functionality to save automata to jpg