script to build jpeg