tree command export to jpg mac code example

Example 1: osx tree

osx doesn't have tree, install by:
brew install tree

Example 2: tree listing in mac

~/$ brew install tree==> Downloading http://mama.indstate.edu/users/ice/tree/src/tree-1.7.0.tgz######################################################################## 100.0%==> make prefix=/usr/local/Cellar/tree/1.7.0 MANDIR=/usr/local/Cellar/tree/1.7.0/share/man/man1 CC=clang CFLAGS=-fomit-frame-pointer LDFLAGS= OBJS=tree.o unix.o html.o xml.o hash.o?  /usr/local/Cellar/tree/1.7.0: 7 files, 128K, built in 4 seconds~/$