Image processing on template