implemented image transformation c functions