General script for image operations