Add image transformation function
improve the transformation functionality