Código PHP:
sx=0;sy=0;swidth=352;sheight=50;x=0;y=0;width=352;height=50;
ctx.drawImage(img,sx,sy,swidth,sheight,x,y,width,height);
sx=0;sy=50;swidth=352;sheight=50;x=0;y=100;width=352;height=50;
ctx.drawImage(img,sx,sy,swidth,sheight,x,y,width,height);