Various scripts and functions for image processing