modified to read image from fig instead of hard drive