Update task_render_galleries.py based on Issue #489

This will prevent the IOError which occurs because of importing the image module which is not from PIL as mentioned in issue #489