trim an image by canvas api