i want to transfrom image like the picture below using canvas,it seems simple but i find no way to do , can anyone give me some ideas?

( left side is the source)